Generate Hashed Directory Structure with Mongoid.
npm install mongoid2hashdir
bash
npm install mongoid2hashdir
`
> Please make sure Node.js is installed.Test
`bash
npm run test
`Documentation
* toArray - Generate hashed directory structure and return it as array
* toFilePath - Generate hashed directory structure and return it as path string
* mkdirs - Generate hashed directory structure and create them$3
__Arguments__
*
mongoid - [String, Object] - Mongoid__Examples__
`js
mongoid2hashdir.toArray('55307ca19be8008e14d4a2c4') // ['ef', 'fe']
`$3
__Arguments__
*
mongoid - [String, Object] - Mongoid__Examples__
`js
mongoid2hashdir.toFilePath('55307ca19be8008e14d4a2c4') // '/ef/fe'
`$3
__Arguments__
*
mongoid - [String, Object] - Mongoid
* basePath - [String] - Base Path
* callback(err, fullPath) - [Function] - A callback which is called when directories are created, or an error occurs.__Examples__
`js
mongoid2hashdir.mkdirs(
'55307ca19be8008e14d4a2c4',
'/any/directory',
function (err, fullPath) {
console.log('fullPath: ', fullPath)
// '/any/directory/ef/fe/55307ca19be8008e14d4a2c4' should be created or existed
}
)
``