raszi / node-tmp

Temporary file and directory creator for node.js
MIT License
736 stars 92 forks source link

get RAM temp dir /dev/shm #173

Closed roccomuso closed 6 years ago

roccomuso commented 6 years ago

Wouldn't be also useful to have a way to get a tmp dir in RAM?

like /dev/shm in linux

silkentrance commented 6 years ago

@roccomuso This is up to you and how your system has been configured. AFAIK this cannot be implemented in node-tmp as it will require setting up a memory based tmpfs. And node-tmp should be as agnostic to system specifics as possible, so using /dev/shm directly is out of the question.

raszi commented 6 years ago

You can achieve the requested functionality by passing the dir option and setting that to /dev/shm on Linux:

tmp.file({ dir: '/dev/shm' }, (err, name, fd, fnn) => {});