Socket
Book a DemoInstallSign in
Socket

egg-tmpfs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-tmpfs

A plugin for egg which help to create and auto clean temp folder when request finish or error

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

egg-tmpfs

Greenkeeper badge

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-tmpfs --save

Usage

// {app_root}/config/plugin.js
exports.tmpfs = {
  enable: true,
  package: 'egg-tmpfs',
};

Configuration

// {app_root}/config/config.default.js
exports.tmpfs = {
  baseTmpPath: '/foo/bar',
};

see config/config.default.js for more detail.

api

ctx.tmpfs.ensureDir(dir[,options][,callback])

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.

ctx.tmpfs.mark(path)

just incase you have to use original node fs module, then you can create file first, then mark it need to be delete.

ctx.tmpfs.unmark(path)

to revert what ctx.tmpfs.mark(path) did.

ctx.tmpfs.clean()

clean all tmp folders, return a Promise

Generally, you do not need to use this :) egg-tmpfs will auto call clean.

Example

see test

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

egg

FAQs

Package last updated on 03 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts