Skip to content

Instantly share code, notes, and snippets.

@OllieJones
OllieJones / cache.js
Last active December 3, 2016 02:45 — forked from bshamric/cache.js
I like phantomjs, but it doesn't directly support getting images from webpages without requesting them separately like in casperjs. I went through QTNetworking code in the phantomjs repo until I figured out where the cache was. To use this, have all three files in the same directory. Then modify test.js for whatever you need.Call phantom js with…
var pFs = require('fs');
//this is the path that QTNetwork classes uses for caching files for it's http client
//the path should be the one that has 16 folders labeled 0,1,2,3,...,F
exports.cachePath = '/path/to/phantomjs/cache/data/folder';
//object path
exports.objectPath = '/path/to/phantomjs/cache/objects';
//call this when you first encounter a resource//this is the extension used for files in the cache path