0.0.7 • Published 2 months ago

scraperama v0.0.7

Weekly downloads
4
License
MIT
Repository
github
Last release
2 months ago

scraperama

Scrape files from the internet.

Installation

npm i scraperama -S

Usage

const scraperama = require("scraperama");

scraperama.csv("file.csv", json => {
  console.log(json);
});

scraperama.html("file.html", $ => {
  console.log($("body").html());
});

scraperama.json("file.json", json => {
  console.log(json);
});

scraperama.text("file.txt", text => {
  console.log(text);
});

To download any old file:

scraperama.download(
  "path/to/file.zip", // URL
  `${__dirname}/local/file.zip`, // local file path
  (pct) => { process.stdout.write(`\r${pct.toFixed(1)}%`); }, // log percentage downloaded
  () => { console.log("Done!"); } // callback function
);

To get an object's file size:

scraperama.filesize(object);

To throttle a function:

const logThrottled = scraperama.throttle(console.log, 500);
Array.from({ length: 10 }).forEach((_, i) => logThrottled(i));
0.0.7

2 months ago

0.0.6

2 months ago

0.0.5

5 months ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

4 years ago