mongoid2hashdir
v0.1.0
Published
Generate Hashed Directory Structure with Mongoid.
Downloads
2
Readme
Mongoid2Hashdir
Generate Hashed Directory Structure with Mongoid.
Example: 55307ca19be8008e14d4a2c4 -> /ef/fe
Installation
npm install mongoid2hashdir
Please make sure Node.js is installed.
Test
npm run test
Documentation
toArray
- Generate hashed directory structure and return it as arraytoFilePath
- Generate hashed directory structure and return it as path stringmkdirs
- Generate hashed directory structure and create them
Arguments
mongoid
-[String, Object]
- Mongoid
Examples
mongoid2hashdir.toArray('55307ca19be8008e14d4a2c4') // ['ef', 'fe']
Arguments
mongoid
-[String, Object]
- Mongoid
Examples
mongoid2hashdir.toFilePath('55307ca19be8008e14d4a2c4') // '/ef/fe'
Arguments
mongoid
-[String, Object]
- MongoidbasePath
-[String]
- Base Pathcallback(err, fullPath)
-[Function]
- A callback which is called when directories are created, or an error occurs.
Examples
mongoid2hashdir.mkdirs(
'55307ca19be8008e14d4a2c4',
'/any/directory',
function (err, fullPath) {
console.log('fullPath: ', fullPath)
// '/any/directory/ef/fe/55307ca19be8008e14d4a2c4' should be created or existed
}
)