Add header to repl. Use uppercase Dish in chef export. Fix SyncDish constructor call
This commit is contained in:
parent
e19d3d0d06
commit
cc840c050b
@ -2,6 +2,7 @@
|
|||||||
* @author d98762625 [d98762625@gmail.com]
|
* @author d98762625 [d98762625@gmail.com]
|
||||||
* @copyright Crown Copyright 2018
|
* @copyright Crown Copyright 2018
|
||||||
* @license Apache-2.0
|
* @license Apache-2.0
|
||||||
|
* @module node
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import util from "util";
|
import util from "util";
|
||||||
@ -17,9 +18,13 @@ import * as ops from "./index";
|
|||||||
*/
|
*/
|
||||||
class SyncDish extends Dish {
|
class SyncDish extends Dish {
|
||||||
|
|
||||||
/** */
|
/**
|
||||||
|
* Create a Dish
|
||||||
|
* @param {any} inputOrDish - The dish input
|
||||||
|
* @param {String|Number} - The dish type, as enum or string
|
||||||
|
*/
|
||||||
constructor(inputOrDish=null, type=null) {
|
constructor(inputOrDish=null, type=null) {
|
||||||
super(inputOrDish);
|
super(inputOrDish, type);
|
||||||
|
|
||||||
// Add operations to make it composable
|
// Add operations to make it composable
|
||||||
for (const op in ops) {
|
for (const op in ops) {
|
||||||
@ -115,6 +120,7 @@ class SyncDish extends Dish {
|
|||||||
case Dish.BUFFER:
|
case Dish.BUFFER:
|
||||||
this.value = this.value instanceof Buffer ? this.value.buffer : [];
|
this.value = this.value instanceof Buffer ? this.value.buffer : [];
|
||||||
break;
|
break;
|
||||||
|
// No such API in Node.js.
|
||||||
// case Dish.FILE:
|
// case Dish.FILE:
|
||||||
// this.value = Utils.readFileSync(this.value);
|
// this.value = Utils.readFileSync(this.value);
|
||||||
// this.value = Array.prototype.slice.call(this.value);
|
// this.value = Array.prototype.slice.call(this.value);
|
||||||
@ -161,6 +167,7 @@ class SyncDish extends Dish {
|
|||||||
this.value = Buffer.from(new Uint8Array(this.value));
|
this.value = Buffer.from(new Uint8Array(this.value));
|
||||||
this.type = Dish.BUFFER;
|
this.type = Dish.BUFFER;
|
||||||
break;
|
break;
|
||||||
|
// No such API in Node.js.
|
||||||
// case Dish.FILE:
|
// case Dish.FILE:
|
||||||
// this.value = new File(this.value, "unknown");
|
// this.value = new File(this.value, "unknown");
|
||||||
// break;
|
// break;
|
||||||
|
@ -87,7 +87,7 @@ code += ` };
|
|||||||
const chef = generateChef();
|
const chef = generateChef();
|
||||||
// Add some additional features to chef object.
|
// Add some additional features to chef object.
|
||||||
chef.help = help;
|
chef.help = help;
|
||||||
chef.dish = SyncDish;
|
chef.Dish = SyncDish;
|
||||||
|
|
||||||
// Define consts here so we can add to top-level export - wont allow
|
// Define consts here so we can add to top-level export - wont allow
|
||||||
// export of chef property.
|
// export of chef property.
|
||||||
|
@ -15,7 +15,15 @@ import "babel-polyfill";
|
|||||||
|
|
||||||
/*eslint no-console: ["off"] */
|
/*eslint no-console: ["off"] */
|
||||||
|
|
||||||
console.log("Welcome to CyberChef");
|
console.log(`
|
||||||
|
______ __ ________ ____
|
||||||
|
/ ____/_ __/ /_ ___ _____/ ____/ /_ ___ / __/
|
||||||
|
/ / / / / / __ \\/ _ \\/ ___/ / / __ \\/ _ \\/ /_
|
||||||
|
/ /___/ /_/ / /_/ / __/ / / /___/ / / / __/ __/
|
||||||
|
\\____/\\__, /_.___/\\___/_/ \\____/_/ /_/\\___/_/
|
||||||
|
/____/
|
||||||
|
|
||||||
|
`);
|
||||||
const replServer = repl.start({
|
const replServer = repl.start({
|
||||||
prompt: "chef > ",
|
prompt: "chef > ",
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user