Skip to content

Instantly share code, notes, and snippets.

@TheNoim
Last active June 4, 2017 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheNoim/a8923ba1bb4f81b7c854bf8edbce059c to your computer and use it in GitHub Desktop.
Save TheNoim/a8923ba1bb4f81b7c854bf8edbce059c to your computer and use it in GitHub Desktop.
fs.readFile(path, function (err, contents) {
if(err) callback(err, null);
r.db('db').table('images').insert({
user: name,
file: contents,
elo: 1000
}).run();
})
// Express Router context
r.db('db').table('images').// Deine Query
.run().then(result => {
res.set('Content-Type', 'image/jpeg');
res.set('Content-Length', result.file.length);
res.end(result.file);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment