Skip to content

Conversation

@s0ph1e
Copy link
Member

@s0ph1e s0ph1e commented Apr 8, 2017

No description provided.

@s0ph1e s0ph1e requested a review from aivus April 11, 2017 07:32
README.md Outdated
Scrape function resolves with array of [Resource](https://github.com/s0ph1e/node-website-scraper/blob/master/lib/resource.js) objects which contain `metadata` property from `httpResponseHandler`.

#### resourceStorage
Class which saves [Resources](https://github.com/s0ph1e/node-website-scraper/blob/master/lib/resource.js), should have methods `saveResource` and `removeSavedResources` which return Promises. Use it to save files where you need: to dropbox, amazon S3, existing directory, etc. By default all files are saved in local file system to new directory passed in `directory` option (see [lib/resource-storage.js](https://github.com/s0ph1e/node-website-scraper/blob/master/lib/resource-storage.js)).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use relative links instead of absoulte

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relative links will work on github but not on npm site
I use relative links only to anchors in readme file, but for other files - absolute

README.md Outdated
directory: '/path/to/save',
resourceStorage: class MyResourceStorage {
saveResource (resource) {/* code to save file where you need */}
removeSavedResources() {/* code to remove all previously saved files in case of error */}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear what remove all previously saved files in case of error means.
What the error? Why we have to remove files?

removeSavedResources no any mentions about error. Is it used in any other cases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If error happens and scraper can't continue downloading - it removes previously saved files (used here). The reason is to have completely downloaded site or nothing (I don't want to leave partially downloaded site in the system)

@s0ph1e s0ph1e changed the title Add custom resource storage Add custom resource saver Apr 11, 2017
@s0ph1e s0ph1e merged commit 3b8a025 into master Apr 11, 2017
@s0ph1e s0ph1e deleted the add-custom-fs-adapter branch April 11, 2017 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants