Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takamin/text-chopper
Chop a text to small chunk
https://github.com/takamin/text-chopper
Last synced: about 1 month ago
JSON representation
Chop a text to small chunk
- Host: GitHub
- URL: https://github.com/takamin/text-chopper
- Owner: takamin
- Created: 2019-11-23T05:02:48.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T16:37:23.000Z (almost 2 years ago)
- Last Synced: 2024-04-29T14:01:59.654Z (8 months ago)
- Language: JavaScript
- Size: 1.27 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
text-chopper
============Divide a long text to small chunks.
The text is divided at just the end of line.
The byte length of each chunks are smaller than a size specified by
`chunkSize` of parameter `options`.This is available on both of browser and node.js
## USAGE
Import this module by the CommonJS way.
```javascript
const TextChopper = require("text-chopper");const text = [
"ABCDEFG",
"HIJKLMN",
"OPQRSTU",
].join("\r\n");const chunks = TextChopper.chop(
text, {chunkSize: 10});// chunks[0] == "ABCDEFG\r\n"
// chunks[1] == "HIJKLMN\r\n"
// chunks[2] == "OPQRSTU\r\n"
```## INSTALLATION
Use npm to install.
```bash
$ npm install --save text-chopper
```