This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +9
-7
lines changed Expand file tree Collapse file tree 6 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 60
60
"boom" : " ^3.1.2" ,
61
61
"bs58" : " ^3.0.0" ,
62
62
"debug" : " ^2.2.0" ,
63
+ "detect-node" : " ^2.0.3" ,
63
64
"fs-blob-store" : " ^5.2.1" ,
64
65
"glob" : " ^7.0.3" ,
65
66
"hapi" : " ^13.4.1" ,
122
123
" kumavis <kumavis@users.noreply.github.com>" ,
123
124
" nginnever <ginneversource@gmail.com>"
124
125
]
125
- }
126
+ }
Original file line number Diff line number Diff line change 3
3
const idb = require ( 'idb-plus-blob-store' )
4
4
const IPFSRepo = require ( 'ipfs-repo' )
5
5
6
- module . exports = ( ) => {
7
- return new IPFSRepo ( 'ipfs' , { stores : idb } )
6
+ module . exports = ( dir ) => {
7
+ const repoPath = dir || 'ipfs'
8
+ return new IPFSRepo ( repoPath , { stores : idb } )
8
9
}
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- const isNode = ! global . window
3
+ const isNode = require ( 'detect-node' )
4
4
5
5
module . exports = isNode
6
6
? require ( './node' )
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ module.exports = function init (self) {
67
67
// Add the default assets to the repo.
68
68
function addDefaultAssets ( ) {
69
69
// Skip this step on the browser, or if emptyRepo was supplied.
70
- const isNode = ! global . window
70
+ const isNode = require ( 'detect-node' )
71
71
if ( ! isNode || opts . emptyRepo ) {
72
72
return doneImport ( null )
73
73
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const IPFS = require('../../src/core')
8
8
const Block = require ( 'ipfs-block' )
9
9
const path = require ( 'path' )
10
10
11
- const isNode = ! global . window
11
+ const isNode = require ( 'detect-node' )
12
12
13
13
const fileA = isNode
14
14
? fs . readFileSync ( path . join ( __dirname , '../go-ipfs-repo/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data' ) )
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ function createTempRepo () {
10
10
let store
11
11
let teardown
12
12
13
- const isNode = ! global . window
13
+ const isNode = require ( 'detect-node' )
14
14
if ( isNode ) {
15
15
store = require ( 'fs-blob-store' )
16
16
teardown = ( done ) => {
You can’t perform that action at this time.
0 commit comments