jamiebuilds / Temperment
Licence: mit
Get a random temporary file or directory path that will delete itself
Stars: ✭ 21
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Temperment
matched
Glob matching with support for multiple patterns and negation. Use `~` in cwd to find files in user home, or `@` for global npm modules.
Stars: ✭ 25 (+19.05%)
Mutual labels: files, fs
Go Storage
An application-oriented unified storage layer for Golang.
Stars: ✭ 87 (+314.29%)
Mutual labels: files, fs
go-storage
A vendor-neutral storage library for Golang: Write once, run on every storage service.
Stars: ✭ 387 (+1742.86%)
Mutual labels: files, fs
glob-fs
file globbing for node.js. speedy and powerful alternative to node-glob. This library is experimental and does not work on windows!
Stars: ✭ 54 (+157.14%)
Mutual labels: files, fs
bash-glob
Bash-powered globbing for node.js. Alternative to node-glob. Does not work on Windows 9 and lower.
Stars: ✭ 13 (-38.1%)
Mutual labels: files, fs
copy
Copy files using glob patterns. Sync, async, promise or streams. (node.js utility)
Stars: ✭ 84 (+300%)
Mutual labels: files, fs
Open Shell Book
开源书籍:《Shell 编程范例》,面向操作对象学 Shell!本书作者发布了《360°剖析 Linux ELF》视频课程,欢迎订阅:https://www.cctalk.com/m/group/88089283
Stars: ✭ 666 (+3071.43%)
Mutual labels: files
Aetherupload Laravel
A Laravel package to upload large files 上传大文件的Laravel扩展包
Stars: ✭ 835 (+3876.19%)
Mutual labels: files
Uppy
The next open source file uploader for web browsers 🐶
Stars: ✭ 24,829 (+118133.33%)
Mutual labels: files
Chibisafe
Blazing fast file uploader and awesome bunker written in node! 🚀
Stars: ✭ 657 (+3028.57%)
Mutual labels: files
Fileb0x
a better customizable tool to embed files in go; also update embedded files remotely without restarting the server
Stars: ✭ 583 (+2676.19%)
Mutual labels: files
Filemasta
A search application to explore, discover and share online files
Stars: ✭ 571 (+2619.05%)
Mutual labels: files
Pop
🌽 Generate directories and files in Go as quickly as making pop corn 🌽
Stars: ✭ 23 (+9.52%)
Mutual labels: files
Raw Loader
A loader for webpack that allows importing files as a String
Stars: ✭ 800 (+3709.52%)
Mutual labels: files
temperment
Get a random temporary file or directory path that will delete itself
Install
yarn add temperment
Usage
Same interface as tempy:
const temp = require('temperment');
temp.file(); // "/private/var/folders/9w/8285f7cn29d74zlvk4b2tclh0000gp/T/679be05150c143aec8c08e35b9f2235a"
temp.file({ name: 'foo' }); // "/private/var/folders/9w/8285f7cn29d74zlvk4b2tclh0000gp/T/7ee0b6d4d6fbfa9cf644ad367642815a/foo.txt"
temp.file({ extension: 'txt' }); // "/private/var/folders/9w/8285f7cn29d74zlvk4b2tclh0000gp/T/93b1abc869d30c0ef79c61790d264e6c.txt"
temp.directory(); // "/private/var/folders/9w/8285f7cn29d74zlvk4b2tclh0000gp/T/a1663ccd3f5b1230e6390f549ed02b24"
temp.root; // "/private/var/folders/9w/8285f7cn29d74zlvk4b2tclh0000gp/T"
Manually clean files up asynchronously
const temp = require('temperment');
const fs = require('fs');
const pathExists = require('path-exists');
let fp = temp.file();
pathExists.sync(fp); // false
fs.writeFileSync(fp, 'hello');
pathExists.sync(fp); // true
await temp.cleanup();
pathExists.sync(dir); // false
Manually clean files up synchronously
const fs = require('fs');
const pathExists = require('path-exists');
const temp = require('temperment');
let fp = temp.file();
pathExists.sync(fp); // false
fs.writeFileSync(fp, 'hello');
pathExists.sync(fp); // true
temp.cleanup.sync();
pathExists.sync(dir); // false
However, you don't need to clean files up. This will happen automatically when the process exits (even on errors).
You can also make a standalone instance of temperment where you won't accidentally delete someone else's temp files and they won't accidentally delete yours:
const temperment = require('temperment');
const temp = temperment.standalone();
temp.file();
temp.directory();
await temp.cleanup(); // only delete your own files
await temperment.cleanup(); // won't delete files created by `temp`
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].