This commit is contained in:
lijianyou
2025-09-30 15:00:32 +08:00
parent 1b262f06b8
commit b4e759cf69
202 changed files with 22035 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import { Transform } from 'stream';
export class BufferTransform extends Transform {
constructor(transform) {
super({
objectMode: true,
transform(file, enc, callback) {
if (file.isBuffer()) {
file.contents = Buffer.from(transform(new String(file.contents)));
}
if (file.isStream()) {
console.log('stream file', file.path);
}
return callback(null, file);
},
});
return this;
}
}