-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Upgrade dependencies, use strict and fix /blocks pathing
- Loading branch information
1 parent
45fcfcc
commit a2021b0
Showing
12 changed files
with
93 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
'use strict' | ||
|
||
const PREFIX_LENGTH = 8 | ||
|
||
exports = module.exports | ||
|
||
exports.setUp = (basePath, blobStore, locks) => { | ||
var store = blobStore(basePath + '/blocks') | ||
const store = blobStore(basePath + '/blocks') | ||
|
||
return { | ||
createReadStream: multihash => { | ||
var path = multihashToPath(multihash) | ||
createReadStream: (multihash) => { | ||
const path = multihashToPath(multihash) | ||
return store.createReadStream(path) | ||
}, | ||
|
||
createWriteStream: (multihash, cb) => { | ||
var path = multihashToPath(multihash) | ||
const path = multihashToPath(multihash) | ||
return store.createWriteStream(path, cb) | ||
}, | ||
exists: (multihash, cb) => { | ||
var path = multihashToPath(multihash) | ||
const path = multihashToPath(multihash) | ||
return store.exists(path, cb) | ||
}, | ||
remove: (multihash, cb) => { | ||
var path = multihashToPath(multihash) | ||
const path = multihashToPath(multihash) | ||
return store.remove(path, cb) | ||
} | ||
} | ||
} | ||
|
||
function multihashToPath (multihash) { | ||
var filename = multihash.toString('hex') + '.data' | ||
var folder = filename.slice(0, PREFIX_LENGTH) | ||
var path = folder + '/' + filename | ||
const filename = multihash.toString('hex') + '.data' | ||
const folder = filename.slice(0, PREFIX_LENGTH) | ||
const path = folder + '/' + filename | ||
|
||
return path | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters