Remove Buffer from Dish. Convert into ByteArray in api and then pass in as ArrayBuffer. Add some PNG files to tests

This commit is contained in:
d98762625 2018-08-19 22:55:40 +01:00
parent 20bb104006
commit 55f7cac526
3 changed files with 14 additions and 45 deletions

View file

@ -61,8 +61,6 @@ class Dish {
return Dish.FILE;
case "list<file>":
return Dish.LIST_FILE;
case "buffer":
return Dish.BUFFER;
default:
throw "Invalid data type string. No matching enum.";
}
@ -95,8 +93,6 @@ class Dish {
return "File";
case Dish.LIST_FILE:
return "List<File>";
case Dish.BUFFER:
return "Buffer";
default:
throw "Invalid data type enum. No matching type.";
}
@ -270,8 +266,6 @@ class Dish {
case Dish.LIST_FILE:
return this.value instanceof Array &&
this.value.reduce((acc, curr) => acc && curr instanceof File, true);
case Dish.BUFFER:
return this.value instanceof Buffer;
default:
return false;
}
@ -290,7 +284,6 @@ class Dish {
case Dish.BYTE_ARRAY:
case Dish.STRING:
case Dish.HTML:
case Dish.BUFFER:
return this.value.length;
case Dish.NUMBER:
case Dish.BIG_NUMBER:
@ -364,12 +357,6 @@ class Dish {
this.type
);
break;
case Dish.BUFFER:
newDish.set(
Buffer.from(this.value),
this.type
);
break;
default:
throw new Error("Cannot clone Dish, unknown type");
}
@ -434,12 +421,5 @@ Dish.FILE = 7;
* @enum
*/
Dish.LIST_FILE = 8;
/**
* Dish data type enum for node Buffer.
* @readonly
* @enum
*/
Dish.BUFFER = 9;
export default Dish;