Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【createReadStram】例子 用于路径上的buffer 或者 文件 不适合上传的文件 #75

Open
xdyz opened this issue Jan 6, 2022 · 0 comments

Comments

@xdyz
Copy link

xdyz commented Jan 6, 2022

createReadStram 可以读取路径上的 buffer 文件
但是如果本身不是路径 是上传上来的文件 那么就需要 stream 转为流 数据 然后在进行上传
const bufferStream = new Stream.PassThrough();
const readStream = bufferStream.end(val);
const options = ({ filename: 'sample.json', contentType: 'application/json' });
const startTime = +new Date();
const result = await attachment.write(options, readStream, (error, file) => {
console.log(error);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant