Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
810 B
39 lines
810 B
2 years ago
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.blobToBuffer = blobToBuffer;
|
||
|
exports.blobToString = blobToString;
|
||
|
|
||
|
var _ = require("./");
|
||
|
|
||
|
function _stream() {
|
||
|
const data = require("stream");
|
||
|
|
||
|
_stream = function () {
|
||
|
return data;
|
||
|
};
|
||
|
|
||
|
return data;
|
||
|
}
|
||
|
|
||
|
function blobToBuffer(blob) {
|
||
|
if (blob instanceof _stream().Readable) {
|
||
|
return (0, _.bufferStream)(blob);
|
||
|
} else if (blob instanceof Buffer) {
|
||
|
return Promise.resolve(Buffer.from(blob));
|
||
|
} else {
|
||
|
return Promise.resolve(Buffer.from(blob, 'utf8'));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
async function blobToString(blob) {
|
||
|
if (blob instanceof _stream().Readable) {
|
||
|
return (await (0, _.bufferStream)(blob)).toString();
|
||
|
} else if (blob instanceof Buffer) {
|
||
|
return blob.toString();
|
||
|
} else {
|
||
|
return blob;
|
||
|
}
|
||
|
}
|