pjscrape v.0.1


Namespace pjs.writers

Defined in:
pjscrape.js

Writer namespace. You can add new writers here; new writer classes should probably extend pjs.writers.base and redefine the write method.

Items returned by scrapers will be added to the output via Writer.add(item), which can take any type of object. If an array is provided, multipled items will be added.


        // create a new writer
        pjs.writers.myWriter = function(log) {
            var w = new pjs.writers.base(log);
            w.write = function(s) {
                // write s to some special place
            }
            return w;
        };
        // tell pjscrape to use your writer
        pjs.config({
            writer: 'myWriter'
        });

Static Fields

Field
pjs.writers.file :{Writer}
Writes output to config.outFile
pjs.writers.itemfile :{Writer}
Writes output to one file per item.
pjs.writers.stdout :{Writer}
Write output to STDOUT
Namespace Detail
pjs.writers
Static Field Details
pjs.writers.file :{Writer}
Writes output to config.outFile
pjs.writers.itemfile :{Writer}
Writes output to one file per item. Items may be provided in the format { filename: "file.txt", content: "string" } if you'd like to specify the filename in the scraper. Otherwise, files are written to config.outFile with serial numbering.
pjs.writers.stdout :{Writer}
Write output to STDOUT
©2011 Nick Rabinowitz
Documentation generated by JsDoc Toolkit 2.3.2 on Mon Oct 24 2011 12:16:49 GMT-0700 (PDT)