filenamify alternatives and similar modules
Based on the "Filesystem" category.
Alternatively, view filenamify alternatives based on common mentions on social networks and blogs.
-
fs-extra
Node.js: extra methods for the fs object like copy(), remove(), mkdirs() -
chokidar
Minimal and efficient cross-platform file watching library -
make-dir
Make a directory and its parents if needed - Think `mkdir -p` -
proper-lockfile
An inter-process and inter-machine lockfile utility that works on a local or network file system. -
Filehound
Flexible and fluent interface for searching the file system -
fs-write-stream-atomic
Like `fs.createWriteStream(...)`, but atomic. -
istextorbinary
Determine if a filename and/or buffer is text or binary. Smarter detection than the other solutions.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of filenamify or a related project?
README
filenamify
Convert a string to a valid safe filename
On Unix-like systems, /
is reserved. On Windows, <>:"/\|?*
along with trailing periods are reserved.
Install
$ npm install filenamify
Usage
import filenamify from 'filenamify';
filenamify('<foo/bar>');
//=> 'foo!bar'
filenamify('foo:"bar"', {replacement: '🐴'});
//=> 'foo🐴bar'
API
filenamify(string, options?)
Convert a string to a valid filename.
filenamifyPath(path, options?)
Convert the filename in a path a valid filename and return the augmented path.
import {filenamifyPath} from 'filenamify';
filenamifyPath('foo:bar');
//=> 'foo!bar'
options
Type: object
replacement
Type: string
\
Default: '!'
String to use as replacement for reserved filename characters.
Cannot contain: <
>
:
"
/
\
|
?
*
maxLength
Type: number
\
Default: 100
Truncate the filename to the given length.
Systems generally allow up to 255 characters, but we default to 100 for usability reasons.
Browser-only import
You can also import filenamify/browser
, which only imports filenamify
and not filenamify.path
, which relies on path
being available or polyfilled. Importing filenamify
this way is therefore useful when it is shipped using webpack
or similar tools, and if filenamify.path
is not needed.
import filenamify from 'filenamify/browser';
filenamify('<foo/bar>');
//=> 'foo!bar'
Related
- filenamify-cli - CLI for this module
- filenamify-url - Convert a URL to a valid filename
- valid-filename - Check if a string is a valid filename
- unused-filename - Get a unused filename by appending a number if it exists
- slugify - Slugify a string