Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 83525f1

Browse files
committed
Change fs interface
1 parent 4ea5080 commit 83525f1

File tree

2 files changed

+10
-41
lines changed

2 files changed

+10
-41
lines changed

src/fs.js

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,14 @@ import type {
2222

2323
const RNFetchBlob:RNFetchBlobNative = NativeModules.RNFetchBlob
2424
const emitter = DeviceEventEmitter
25-
26-
// session table
27-
let sessions = {}
28-
29-
/**
30-
* Get path of system directories.
31-
* @return {object} Map contains DocumentDir, CacheDir, DCIMDir, DownloadDir,
32-
* , some directory might not be supported by platform.
33-
*/
34-
function getSystemDirs() {
35-
return new Promise((resolve, reject) => {
36-
try {
37-
RNFetchBlob.getEnvironmentDirs((...dirs) => {
38-
let [
39-
DocumentDir,
40-
CacheDir,
41-
// Android only
42-
DCIMDir,
43-
DownloadDir,
44-
PictureDir,
45-
MusicDir,
46-
MovieDir,
47-
RingToneDir] = [...dirs]
48-
resolve({
49-
DocumentDir,
50-
CacheDir,
51-
DCIMDir,
52-
DownloadDir,
53-
PictureDir,
54-
MusicDir,
55-
MovieDir,
56-
RingToneDir
57-
})
58-
})
59-
} catch(err) {
60-
reject(err)
61-
}
62-
})
25+
const dirs = {
26+
DocumentDir : RNFetchBlob.DocumentDir,
27+
CacheDir : RNFetchBlob.CacheDir,
28+
PictureDir : RNFetchBlob.PictureDir,
29+
MusicDir : RNFetchBlob.MusicDir,
30+
MovieDir : RNFetchBlob.MovieDir,
31+
DownloadDir : RNFetchBlob.DownloadDir,
32+
DCIMDir : RNFetchBlob.DCIMDir
6333
}
6434

6535
/**
@@ -289,7 +259,6 @@ export default {
289259
session,
290260
ls,
291261
readStream,
292-
getSystemDirs,
293262
mv,
294263
cp,
295264
writeStream,
@@ -298,5 +267,6 @@ export default {
298267
isDir,
299268
stat,
300269
lstat,
301-
scanFile
270+
scanFile,
271+
dirs
302272
}

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import fs from './fs'
2121
import base64 from 'base-64'
2222
const {
2323
RNFetchBlobSession,
24-
getSystemDirs,
2524
readStream,
2625
createFile,
2726
unlink,

0 commit comments

Comments
 (0)