A plugin for egg which help to create and auto clean temp folder when request finish or error
MIT License
$ npm i egg-tmpfs --save
// {app_root}/config/plugin.js
exports.tmpfs = {
enable: true,
package: 'egg-tmpfs',
};
// {app_root}/config/config.default.js
exports.tmpfs = {
baseTmpPath: '/foo/bar',
};
see config/config.default.js for more detail.
same as fsextra.ensureDir, but path will based on config.tmpfs.baseTmpPath
, and the created folder will be auto cleand when request is finished or errored.
just incase you have to use original node fs module, then you can create file first, then mark it need to be delete.
to revert what ctx.tmpfs.mark(path)
did.
clean all tmp folders, return a Promise
Generally, you do not need to use this :) egg-tmpfs will auto call clean.
see test
Please open an issue here.