Initial commit

This commit is contained in:
jiapengyu
2026-07-27 13:37:48 +08:00
commit ecba71e2a5
39123 changed files with 5989154 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import { Stream } from "stream";
import { PassThrough } from "readable-stream";
import { isStream } from "is-stream";
export function normalizeInputSource(source) {
if (source === null) {
return Buffer.alloc(0);
} else if (typeof source === "string") {
return Buffer.from(source);
} else if (isStream(source) && !source._readableState) {
var normalized = new PassThrough();
source.pipe(normalized);
return normalized;
}
return source;
}
export default {
normalizeInputSource,
};