mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
add immutable presentAs method to Dish for node REPL display. add test for exact match help
This commit is contained in:
parent
8f5f3e56cb
commit
8eed2232ee
5 changed files with 55 additions and 11 deletions
|
@ -21,12 +21,17 @@ class File {
|
|||
*
|
||||
* https://w3c.github.io/FileAPI/#file-constructor
|
||||
*
|
||||
* @param {String|Array|ArrayBuffer|Buffer} bits - file content
|
||||
* @param {String|Array|ArrayBuffer|Buffer|[File]} bits - file content
|
||||
* @param {String} name (optional) - file name
|
||||
* @param {Object} stats (optional) - file stats e.g. lastModified
|
||||
*/
|
||||
constructor(data, name="", stats={}) {
|
||||
const buffers = data.map(d => Buffer.from(d));
|
||||
const buffers = data.map((d) => {
|
||||
if (d instanceof File) {
|
||||
return Buffer.from(d.data);
|
||||
}
|
||||
return Buffer.from(d);
|
||||
});
|
||||
const totalLength = buffers.reduce((p, c) => p + c.length, 0);
|
||||
this.data = Buffer.concat(buffers, totalLength);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue