Convert a filename to a partitioned directory and filename

npm install partdir
1 downloads in the last week
4 downloads in the last month


If you need to store loads of files partdir can convert a filename to a hash where the leading part is used as a directory and the remainder as a filename.


var path = require('path');
var partdir = require('partdir');

var parted = partdir('myfile.bin');
console.log(path.join(parted.dir, parted.file)

prints 2a/a3455b63e270b69736191c20c76a162c0c26e0.

npm loves you