我有一个明确的应用程序,用户可以上传照片。我正在使用节点强大来处理上传部分。我也有node-graphicsmagick做这些照片的操纵,如创建缩略图,读取exif数据。节点强大的写入临时文件,node-graphicsmagick也是如此。然后我使用knox将照片上传到S3。
I have an express app where the users can upload photos. I am using node-formidable for handling the upload part. I also have node-graphicsmagick for doing manipulations on those photos like creating thumbnail, reading exif data. The node-formidable writes to a temporary file and so does node-graphicsmagick. I then upload the photos to S3 using knox.
我的问题是,在使用knox上传到S3之后,我无法理解如何处理临时文件。我知道如果我不处理它,那么它可能会导致问题,但不知道该怎么办? 请帮助我
My problem is I am not able to understand how to handle the temporary file after doing the upload to S3 using knox. I know if I don't handle it then it can cause problems but not being sure what to do?? Please help me.
使用流是一个选项,但我无法了解如何从节点强壮和节点图形流中流。流媒体也是一个很好的选择,我想知道它是否可能。
Using streams is an option but I am not able to understand how to stream from node-formidable and node-graphicsmagick. Streaming is also a good option and I want to know if its possible.
请帮助我。谢谢
推荐答案只需删除它:
var fs = require('fs'); var tmpFN = req.files.yourFieldName.meta.path; fs.unlink(tmpFN, function(err){ if(err){ console.log(err); callback(err) } else { callback(null) }; });更多推荐
上传后处理临时文件
发布评论