Comments (8)
@wkh237 On the bright side, I've done a few simple tests that include the new error code (err.code) and the new hash
function and that at least works.
(Note: the initial comment was about a plain RNFB-dev package and whatever version of RNFB it installs. Below is about my own test project directory, based on a basic react-native init TestProject
, using my own repo and it 0.10.9 branch (https://github.com/lll000111/react-native-fetch-blob/tree/0.10.9).
VERY simple and quick test:
RNFetchBlob.fs.mkdir('/storage/emulated/0/ONE')
.catch(err => {
console.log('MKDIR', err.code, err.name, err.message);
if (!err.message.includes('already exists')) {
throw err;
}
})
.then(() => RNFetchBlob.fs.exists('/storage/emulated/0/ONE/DEMO-FILE.txt'))
.then(exists => {
console.log('EXISTS', exists);
if (exists) {
return RNFetchBlob.fs.unlink('/storage/emulated/0/ONE/DEMO-FILE.txt');
}
})
.then(() => RNFetchBlob.fs.createFile('/storage/emulated/0/ONE/DEMO-FILE.txt', 'DEMOooooo 1111 CONTENT'))
.then(() => RNFetchBlob.fs.createFile('/storage/emulated/0/ONE/DEMO-FILE.txt', 'DEMOooooo 1111 CONTENT'))
.catch(err => {
console.log('CREATE ERROR:', err.code, err.name, err.message);
})
.then(() => RNFetchBlob.fs.readFile('/storage/emulated/0/ONE/NO-SUCH-FILE', 'utf8'))
.catch(err => {
console.log('CREATE ERROR:', err.code, err.name, err.message);
})
.then(() => RNFetchBlob.fs.readFile('/storage/emulated/0/ONE/DEMO-FILE.txt', 'utf8'))
.then(result => console.log(1, result))
.then(() => RNFetchBlob.fs.writeFile('/storage/emulated/0/ONE/DEMO-FILE.txt', 'DEMOooooo 222 CONTENT'))
.then(() => RNFetchBlob.fs.readFile('/storage/emulated/0/ONE/DEMO-FILE.txt', 'utf8'))
.then(result => console.log(2, result))
.then(() => RNFetchBlob.fs.hash('/storage/emulated/0/ONE/DEMO-FILE.txt', 'sha256'))
.then(result => console.log(3, result))
.then(() => responseJson)
The result of that tiny test:
'MKDIR', 'EEXIST', 'Error', 'Folder \'/storage/emulated/0/ONE\' already exists'
'EXISTS', true
'CREATE ERROR:', 'EEXIST', 'Error', 'File `/storage/emulated/0/ONE/DEMO-FILE.txt` already exists'
'CREATE ERROR:', 'ENOENT', 'Error', 'No such file or directory \'/storage/emulated/0/ONE/NO-SUCH-FILE\'; /storage/emulated/0/ONE/NO-SUCH-FILE: open failed: ENOENT (No such file or directory)'
1, 'DEMOooooo 1111 CONTENT'
2, 'DEMOooooo 222 CONTENT'
3, 'be04da7bae1145ce4f5d2df9720fafb6e01182ff4e04f801413d805eef1b27d5'
Now, if only I could get the tests to run too...
from react-native-fetch-blob-dev.
I think the image-pickernpm module needs to be updated to version 0.26.4 in package.json: react-native-image-picker/react-native-image-picker#653
Without it there is an error:
D:\Documents\Projects\react-native-fetch-blob-dev\RNFetchBlobTest\node_modules\react-native-image-picker\android\src\main\java\com\imagepicker\ImagePickerPackage.java:34: error: method does not override or implement a method from a supertype
@Override
^
1 error
:react-native-image-picker:compileReleaseJavaWithJavac FAILED
The app starts after I update this, but I only see the default "hello world" app screen. I guess need that server to run...?
from react-native-fetch-blob-dev.
When I move the .git
directory away I don't get errors any more - but the server is in an endless file changed
loop, copying the same files over and over.
from react-native-fetch-blob-dev.
SLASHES! The problem are "/" vs. "". I'm running on Windows. When I add
console.log(targetPath, path, source, dest);
In line 297, in the on('add',...)
event handler of the watcher, I get this result:
$ node server.js
SSL test server running at port 8124
test server running at port 8123
..\test\.flowconfig ..\test\.flowconfig ../test/ ../RNFetchBlobTest/
..\test\benchmark.js ..\test\benchmark.js ../test/ ../RNFetchBlobTest/
..\test\index.android.js ..\test\index.android.js ../test/ ../RNFetchBlobTest/
..\test\index.ios.js ..\test\index.ios.js ../test/ ../RNFetchBlobTest/
..\test\index.test.js ..\test\index.test.js ../test/ ../RNFetchBlobTest/
..\test\nedb.js ..\test\nedb.js ../test/ ../RNFetchBlobTest/
...(etc.)
So the String(path).replace(source, dest)
in line 296 does not do anything.
from react-native-fetch-blob-dev.
I got the tests to run, but it stops with two unhandled promise rejections and
Possible Unhandled Promise Rejection (id: 1):
Error: Failed to connect to localhost/127.0.0.1:8123
http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:60368:32
__invokeCallback@http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4887:21
http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4711:32
__guard@http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4822:11
invokeCallbackAndReturnFlushedQueue@http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4710:19
invokeCallbackAndReturnFlushedQueue@[native code]
The screen stops at this state:
On repeat I don't get it to communicate (and run) at all. The app-GUI is up, the server is up - nothing happens, one by one the items on the screen turn to red timeouts.
from react-native-fetch-blob-dev.
I'll close it for now until I figure out what's going on. Apparently I don't have network enabled in the emulator.
from react-native-fetch-blob-dev.
@lll000111 , thanks for the great information. However it's working fine on my end (Mac). Never tried it on windows or linux. Perhaps that's something related to how watch
is working on different platform.
from react-native-fetch-blob-dev.
I'll submit a PR for this repo with additonal tests for "fs", like the new hash function, and the new error structure (with a code
property as implemented in the react-native promise bridge code). I added path = path.replace(/\\/g, '/');
to all three "chokidar" event handler functions, which should have no effect on platforms with only "/" but fix the problem on Windows. Yes, definitely an issue in the "chokidar" package. I also added .git/
to the "chokidar" ignore pattern so that one can use ones own repo directly from github and do some development.
My tests now run and I'm at 100% - of the stuff that I'm testing, which is mostly "fs", where almost all my editing took place.
I'll prepare the PR later today or tomorrow - I have more trouble with git and creating a PR than with the actual code... if I just create a new PR based on the same branch as before the previous commits are included. "Just create a new branch" - well, I tried many combinations of that and I hate git. If I used mere text patches this would be no problem at all, git makes it MUCH more complicated,
PS: The network problem went away when I switched the localhost:8123
against 10.0.2.2:8123
(same for https). I'm using the emulator, where the special IP address 10.0.2.2 inside the emulator points to the host's 127.0.0.1 - the emulator has its own encapsulated network environment and no direct connection to the outside.
from react-native-fetch-blob-dev.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-fetch-blob-dev.