Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@ridi/comic-parser
Advanced tools
Common comic data parser for Ridibooks services
npm install @ridi/comic-parser
Basic:
import { ComicParser } from '@ridi/comic-parser';
// or const { ComicParser } = require('@ridi/comic-parser');
const parser = new ComicParser('./foo/bar.zip' or './unzippedPath');
parser.parse(/* { parseOptions } */).then((book) => {
parser.readItems(items/*, { readOptions } */).then((results) => {
...
});
...
});
with AesCryptor:
import { CryptoProvider, AesCryptor } from '@ridi/comic-parser';
// or const { CryptoProvider, AesCryptor } = require('@ridi/comic-parser');
const { Purpose } = CryptoProvider;
const { Modes, Padding } = AesCryptor;
class ContentCryptoProvider extends CryptoProvider {
constructor(key) {
super();
this.cryptor = new AesCryptor(Modes.ECB, { key });
}
getCryptor(filePath, purpose) {
return this.cryptor;
}
// If use as follows:
// const provider = new ContentCryptoProvider(...);
// const parser = new ComicParser('encrypted.zip', provider);
// const book = await parser.parse({ unzipPath: ... });
// const firstImage = await parser.readItem(book.items[0]);
//
// It will be called as follows:
// 1. run(data, 'encrypted.zip', Purpose.READ_IN_DIR)
// 2. run(data, '0001.jpg', Purpose.READ_IN_ZIP)
// ...
// 4. run(data, '0001.jpg', Purpose.WRITE)
// ...
// 5. run(data, '0001.jpg', Purpose.READ_IN_DIR)
//
run(data, filePath, purpose) {
const cryptor = this.getCryptor(filePath, purpose);
const padding = Padding.AUTO;
if (purpose === Purpose.READ_IN_DIR) {
return cryptor.decrypt(data, padding);
} else if (purpose === Purpose.WRITE) {
return cryptor.encrypt(data, padding);
}
return data;
}
}
const cryptoProvider = new ContentCryptoProvider(key);
const parser = new ComicParser('./encrypted.zip' or './unzippedPath', cryptoProvider);
Log level setting:
import { LogLevel, ... } from '@ridi/comic-parser';
const parser = new ComicParser(/* path */, /* cryptoProvider */, /* logLevel */)
// or const parser = new ComicParser(/* path */, /* logLevel */)
parser.logger.logLevel = LogLevel.VERBOSE; // SILENT, ERROR, WARN(default), INFO, DEBUG, VERBOSE
Returns Promise<ComicBook>
with:
Or throw exception.
?object
Returns string
or Buffer
in Promise
with:
If readOptions.base64
is true
:
string
Other:
Buffer
or throw exception.
?object
Returns string[]
or Buffer[]
in Promise
with:
If readOptions.base64
is true
:
string
Other:
Buffer
or throw exception.
?object
Returns Promise<boolean>
with:
true
, unzip is successful or has already been unzipped.Or throw exception.
string
boolean
Tells the progress of parser through callback
.
const { Action } = ComicParser; // PARSE, READ_ITEMS
parser.onProgress = (step, totalStep, action) => {
console.log(`[${action}] ${step} / ${totalStep}`);
}
?string
If specified, unzip to that path.
only using if input is Zip file.
Default: undefined
boolean
If true, overwrite to unzipPath when unzip.
only using if unzipPath specified.
Default: true
string[]
File extension to allow when extracting lists.
Default: ['jpg', 'jpeg', 'png', 'bmp', 'gif']
boolean|number
If true, image size parse. (parse may be slower.)
Default: false
If true, ignore any exceptions that occur within parser.
Default: false
boolean
If false, reads image into a buffer.
Default: false
FAQs
Common comic data parser for Ridibooks services
We found that @ridi/comic-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.