Skip to content

Easily create and use temp dirs without worrying about clean up

Notifications You must be signed in to change notification settings

0xch4z/with-tmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

with-tmpdir Build Status

Easily create a temporary directory without having to worry about cleanup.

import withTmpdir from 'with-tmpdir';

await withTmpdir('my-tmp-dir', dir => {
  const path = path.join(dir, 'my-file');
  fs.writeFileSync(path, 'content');
}); // tmpdir is cleaned up

Do tasks from within the temporary directory without having to worry about restoring your environment.

import { withinTmpdir } from 'with-tmpdir';

process.cwd(); // => /home/me/workspace
await withinTmpdir('my-other-tmp-dir', dir => {
  process.cwd(); // => /private/var/folders/83/5913m0b1080000gn/T/my-other-tmp-dir2Ivp7V
});

About

Easily create and use temp dirs without worrying about clean up

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published