You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the global file system bootstraps asynchronously,
API calls made right after require('things-js').GFS(mongoUrl) fails because the connection is not open by then.
Example:
var gfs = require('things-js').GFS('mongodb://localhost/my-global-filesystem');
gfs.readFile('/my-test-file.json', function(err, data){
console.log(data.toString());
});
In this example, if the mongo client is not ready by line 2 (which it won't be for most devices)
the readFile call fails.
If we were to keep the synchronous interface so that people don't have to write for example:
Since the global file system bootstraps asynchronously,
API calls made right after
require('things-js').GFS(mongoUrl)
fails because the connection is not open by then.Example:
In this example, if the mongo client is not ready by line 2 (which it won't be for most devices)
the
readFile
call fails.If we were to keep the synchronous interface so that people don't have to write for example:
we would need to implement GFS as a duplex stream and maintain a request/response buffer.
The text was updated successfully, but these errors were encountered: