chore: tidy

This commit is contained in:
cha0s 2021-01-27 22:30:15 -06:00
parent 10c21faa74
commit dab5a84d6f
3 changed files with 12 additions and 12 deletions

View File

@ -34,6 +34,10 @@ export default class BinaryController {
);
}
static decode(encoded) {
return Buffer.from(encoded, 'base64');
}
static encode(buffer) {
return buffer.toString('base64');
}
@ -42,8 +46,4 @@ export default class BinaryController {
return /.*/;
}
static decode(encoded) {
return Buffer.from(encoded, 'base64');
}
}

View File

@ -19,6 +19,10 @@ export default class TextController {
);
}
static decode(encoded) {
return Buffer.from(encoded, 'utf8');
}
static encode(buffer) {
return buffer.toString('utf8');
}
@ -27,8 +31,4 @@ export default class TextController {
return /\.txt$/;
}
static decode(encoded) {
return Buffer.from(encoded, 'utf8');
}
}

View File

@ -55,6 +55,10 @@ export default class JsonController {
);
}
static decode(encoded) {
return Buffer.from(JSON.stringify(encoded, null, 2), 'utf8');
}
static encode(buffer) {
return JSON.parse(buffer.toString('utf8'));
}
@ -63,8 +67,4 @@ export default class JsonController {
return /\.json$/;
}
static decode(encoded) {
return Buffer.from(JSON.stringify(encoded, null, 2), 'utf8');
}
}