Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8121dbf
Apply possible fix to fs.readFile and fs.readStream for #287
wkh237 Mar 27, 2017
4d15c0f
Merge branch '0.10.5' into issue-287-wip
wkh237 Apr 16, 2017
40fefd4
Add Android fs.readFile app provider URI support #287
wkh237 Apr 16, 2017
50a4d06
Merge branch 'issue-287-merged' into uri
wkh237 Jul 2, 2017
a8cfeb1
Correct app content provider URI handle #287
wkh237 Jul 2, 2017
bb7fec4
Merge branch 'issue-287' of github.com:wkh237/react-native-fetch-blob…
wkh237 Jul 2, 2017
08f8403
Fixed a bug which causes XMLHttpRequest getting incorrect header when…
wkh237 Jul 3, 2017
c217fab
Merge branch 'uri' into 0.10.7
wkh237 Jul 3, 2017
8a75a9b
Set mime if set in addAndroidDownloads (#421)
jsm Jul 3, 2017
ed2732a
Fix Download Manager bug when the file is not a multimedia #391
wkh237 Jul 5, 2017
dd4dbb2
Merge branch '0.10.7' of github.com:wkh237/react-native-fetch-blob in…
wkh237 Jul 5, 2017
6bb7c65
Add support for TLS 1.2 when running Android 4 (#430)
jhellman Jul 14, 2017
b70a124
Update README.md
wkh237 Jul 14, 2017
712c8a3
[iOS] Fix for RNFetchBlob.writeChunk failing to write base64 encoded …
joshbax Jul 17, 2017
d83d800
Add missing API Blob.safeClose()
wkh237 Jul 25, 2017
d1d07d0
Fix Compilation Error in React Native 0.47.0 (#452)
Hizoul Aug 2, 2017
206588f
Merge branch 'master' of github.com:wkh237/react-native-fetch-blob in…
wkh237 Aug 2, 2017
6bde516
Bump to 0.10.7
wkh237 Aug 2, 2017
5f3c018
Merge branch '0.10.7' of github.com:wkh237/react-native-fetch-blob in…
wkh237 Aug 2, 2017
50c1573
Update PULL_REQUEST_TEMPLATE
wkh237 Aug 2, 2017
55009f1
Correct unterminated string #455
wkh237 Aug 3, 2017
9ab4ebb
bump to 0.10.8
bcpclone Aug 3, 2017
1336555
Update PULL_REQUEST_TEMPLATE
wkh237 Aug 3, 2017
2aea0b5
Fix path argument in iOS excludeFromBackupKey (#473)
grylance Aug 9, 2017
821eeb0
Fix README (#501)
moschan Aug 24, 2017
c7b9e2e
Handle content URIs correctly
Sep 20, 2017
703880b
Remove unused warning event
tombailey Sep 29, 2017
c7f0c23
Don't enforce app label on library consumer
tombailey Jan 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add missing API Blob.safeClose()
  • Loading branch information
wkh237 authored Jul 25, 2017
commit d83d8007a8e8cdddda368d78bb622a53a99b8d3b
16 changes: 16 additions & 0 deletions polyfill/Blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ export default class Blob extends EventTarget {
// Blob data from file path
else if(typeof data === 'string' && data.startsWith('RNFetchBlob-file://')) {
log.verbose('create Blob cache file from file path', data)
// set this flag so that we know this blob is a wrapper of an existing file
this._isReference = true
this._ref = String(data).replace('RNFetchBlob-file://', '')
let orgPath = this._ref
if(defer)
Expand Down Expand Up @@ -282,6 +284,20 @@ export default class Blob extends EventTarget {
})
}

safeClose() {
if(this._closed)
return Promise.reject('Blob has been released.)
this._closed = true
if(!this._isReference) {
return fs.unlink(this._ref).catch((err) => {
console.warn(err)
})
}
else {
return Promise.resolve()
}
}

_invokeOnCreateEvent() {
log.verbose('invoke create event', this._onCreated)
this._blobCreated = true
Expand Down