Open neumino opened 9 years ago
Hey, @neumino I'm trying to work on this, but I'm having trouble with resultFormat:binary
. I tried resolving the promise with:
{
$reql_type$: 'BINARY',
data: new Buffer(response).toString('base64')
}
But the output for http://httpbin.org/image/png differs from the RethinkDB server:
ReQLite: <Buffer ef bf bd 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 64 00 00 00 64 08 02 00 00 00 ef bf bd ef bf bd 02 03 00 00 1f 61 49 44 41 54 78 ef bf ... >
RethinkDB: <Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 64 00 00 00 64 08 02 00 00 00 ff 80 02 03 00 00 1f 61 49 44 41 54 78 9c dd 7d 77 58 53 d9 d6 ... >
If you wanna have a look, I just pushed up my changes here: https://github.com/marshall007/reqlite/tree/http-options
Oh, nevermind. It's because request
assumes utf8
encoding by default.
Thanks @marshall007 for your help! :)
Now only a simple GET is supported.
Options to add:
This should be pretty easy to add. It's just about updating this method: https://github.com/neumino/reqlite/blob/060a3846d2287443790770e0c7a56b8b049f69ed/lib/query.js#L3693