上传后处理临时文件

编程入门 行业动态 更新时间:2024-10-16 22:24:44
本文介绍了上传后处理临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个明确的应用程序,用户可以上传照片。我正在使用节点强大来处理上传部分。我也有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) }; });

更多推荐

上传后处理临时文件

本文发布于:2023-07-06 07:38:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047406.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:临时文件   后处理   上传

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!