Closed nunuqq1 closed 2 years ago
It already does return a readable stream: https://github.com/npm/node-tar/blob/main/lib/create.js#L100-L104
Pack
is a readable stream. https://github.com/npm/node-tar/blob/main/lib/pack.js#L3
const tarReadableStream = tar.c({ gzip: false, basename: true }, ['./']) const putRet = await minioClient.putObject('xxx', 'yyy.tar', someReadableStream)
error TypeError: third argument should be of type "stream.Readable" or "Buffer" or "string"
function isReadableStream(arg) { return isObject(arg) && isFunction(arg._read); } // check if arg is boolean
minio use the code above to check
It's not an internal node readable stream it's a minipass
stream. Because of that you may have to pipe it to another internal node stream to get other software that is expecting specific data types to work.
Or you can open up an issue w/ minio to ask them to support minpass streams.
thanks for reply, i've fix the issue using stream.Transform
minio can upload a readable stream, using minioClient.putObject('xxx', 'yyy.tar', someReadableStream) so how to transform the return value of tar.c() to a readable stream?