Skip to content

Commit ddbb94b

Browse files
author
Ruben Bridgewater
committed
Fix file example
Fixes #176
1 parent 643eb95 commit ddbb94b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

examples/file.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
// Read a file from disk, store it in Redis, then read it back from Redis.
44

55
var redis = require('redis'),
6-
client = redis.createClient(),
6+
client = redis.createClient({
7+
return_buffers: true
8+
}),
79
fs = require('fs'),
8-
filename = 'kids_in_cart.jpg';
10+
assert = require('assert'),
11+
filename = 'grumpyCat.jpg';
912

1013
// Get the file I use for testing like this:
11-
// curl http://ranney.com/kids_in_cart.jpg -o kids_in_cart.jpg
14+
// curl http://media4.popsugar-assets.com/files/2014/08/08/878/n/1922507/caef16ec354ca23b_thumb_temp_cover_file32304521407524949.xxxlarge/i/Funny-Cat-GIFs.jpg -o grumpyCat.jpg
1215
// or just use your own file.
1316

1417
// Read a file from fs, store it in Redis, get it back from Redis, write it back to fs.
@@ -21,6 +24,7 @@ fs.readFile(filename, function (err, data) {
2124
if (err) {
2225
console.log('Get error: ' + err);
2326
} else {
27+
assert.strictEqual(data.inspect(), reply.inspect());
2428
fs.writeFile('duplicate_' + filename, reply, function (err) {
2529
if (err) {
2630
console.log('Error on write: ' + err);

0 commit comments

Comments
 (0)