
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
4chan-downloader
Advanced tools
Downloads all files in 4chan threads.
npm install -g 4chan-downloader
Help output:
Usage: 4chan [options] <url> [<dir>]
Examples:
4chan <url> Download all files in a thread into {cwd}.
4chan <url> foo Download all files in a thread into {cwd}/foo.
4chan <url> foo/bar Download all files in a thread into {cwd}/foo/bar.
4chan -w <url> Download all and watch for new files.
4chan -w -i 20 <url> Download all and check for new files every 20 seconds.
4chan -f gif,webm <url> Download all gif and webm files.
4chan -s 200x100 <url> Download all files bigger than 200x100 pixels.
4chan -s 100 <url> Download all files bigger than 100x100 pixels.
Options:
-w, --watch Watch for new files.
-i, --interval Watching interval in seconds. [default: 10]
-f, --filter Filter specific file types. [default: "jpg,gif,png,webm"]
-o, --override Override existing files.
-n, --names Save with original file names.
-s, --size Smallest files to download. [default: "100x100"]
-t, --threads Limit of simultaneous downloads. [default: 1]
-v, --version Show version.
-h, --help Show help.
var FortuneDownloader = require('4chan-downloader');
var thread = new FortuneDownloader('http://boards...')
.threads(4)
.watch()
.downloadTo('foo/bar');
// ...
thread.stop();
Consturctor. new keyword is optional. All methods are chaining.
Set number of downloading threads.
Make instance watch for new files.
interval Integer Watching interval in millisecods. Default: 10000
Custom function that filters out specific files. Function returns true when the file should be downloaded and false otherwise.
Function arguments:
Object File description object:
{
url: 'http://i.4cdn.org/g/1407348528901.jpg',
prettysize: '650 KB',
width: 1920,
height: 1080,
name: 'Original file name.jpg',
idname: '1407348528901.jpg',
type: 'jpg',
size: 0, // set when file stars downloading
completed: 0, // updated during downloading
progress: 0 // updated during downloading
}
Custom function that returns the name to be used when saving files.
Function arguments:
Object File description object:
{
url: 'http://i.4cdn.org/g/1407348528901.jpg',
prettysize: '650 KB',
width: 1920,
height: 1080,
name: 'Original file name.jpg',
idname: '1407348528901.jpg',
type: 'jpg',
size: 0, // set when file stars downloading
completed: 0, // updated during downloading
progress: 0 // updated during downloading
}
Set whether instance should override already existing files. Default behavior is false.
BooleanWhere to save files. By default files are saved into current working directory.
StringStarts downloading.
Shorthand for:
FortuneDownloader(url)
.destination('foo/bar')
.download();
Clears current download queue, and cancels watching when in progress.
It does not cancel ongoing download streams.
After #stop() has been called and ongoing downloads finished, end event will be fired. If there were no ongoing downloads, end will be fired immediately.
Type String. Thread URL.
Type Array. Array of files (file descriptor objects) to be downloaded. File is removed from here right before file:start event.
Type Array. Array of downloaded file URLs. When watching is active, any subsequent download will filter out files in this array.
Type Integer. Number of currently active download threads in progress.
FortuneDownloader instance is an event emitter.
Triggered when page has been parsed, and #queue array has been populated with files soon to be downloaded.
Triggered when download canceling error has happened. When this event fires, end event won't.
Callback arguments:
ErrorTriggered when download instance has finished downloading all files, and watching is not enabled.
Also fires when #stop() is called and all ongoing downloads finish.
Triggered when file starts downloading.
Callback arguments:
Object File descriptor object:
{
url: 'http://i.4cdn.org/g/1407348528901.jpg',
prettysize: '650 KB',
width: 1920,
height: 1080,
name: 'Original file name.jpg',
idname: '1407348528901.jpg',
type: 'jpg',
size: 665600, // available now
completed: 0,
progress: 0
}
Triggered when chunk of a file has been received.
Callback arguments:
BufferObject File descriptor object:
{
url: 'http://i.4cdn.org/g/1407348528901.jpg',
prettysize: '650 KB',
width: 1920,
height: 1080,
name: 'Original file name.jpg',
idname: '1407348528901.jpg',
type: 'jpg',
size: 665600,
completed: 40253, // sum of all chunks till now
progress: 0.06139871873093349603416717510677 // completed / size
}
Same as chunk, but without the chunk argument:
Object File descriptor object:
{
url: 'http://i.4cdn.org/g/1407348528901.jpg',
prettysize: '650 KB',
width: 1920,
height: 1080,
name: 'Original file name.jpg',
idname: '1407348528901.jpg',
type: 'jpg',
size: 665600,
completed: 40253, // sum of all chunks till now
progress: 0.06139871873093349603416717510677 // completed / size
}
Triggered when file downloading error has happened. These errors don't stop the downloading process.
Callback arguments:
ErrorObject File descriptor object.Triggered when file has finished with downloading.
Callback arguments:
Object File descriptor object.MIT
FAQs
Downloads all files in 4chan threads.
We found that 4chan-downloader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.