tomvlk / node-split-file Goto Github PK
View Code? Open in Web Editor NEW:seedling: NodeJS Module to split and merge files for several purposes like transporting over unstable networks.
License: MIT License
:seedling: NodeJS Module to split and merge files for several purposes like transporting over unstable networks.
License: MIT License
I am separating and joining arbitrary binary files. The merged file has a different size from the original and is truncated.
Node gives me this error
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
I split large file, then sequently upload them one by one.
When trying to split CheckDetails.xlxs file then generating a file like CheckDetails.xlxs.sf-part01 and so on and when trying to rewrite new xlxs file from the generated file then not able to get back the original file, in fact, getting empty xlsx file
I've followed the example here and done this:
in HTML I have:
<input type='file' id='input' @change="testUpload">
const file = document.getElementById('input').files[0];
splitFile.splitFile(file, 3)
.then((names) => {
console.log(names);
})
.catch((err) => {
console.log('Error: ', err);
});
and i get this error:
vue.runtime.esm.js?2b0e:1888 TypeError: expecting a function but got [object Undefined]
at Function.Promise.promisify (bluebird.js?f684:4098)
at SplitFile.splitFile (split-file.js?c48c:33)
at VueComponent.testUpload (SaveData.vue?ad64:103)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at HTMLInputElement.invoker (vue.runtime.esm.js?2b0e:2179)
at HTMLInputElement.original._wrapper (vue.runtime.esm.js?2b0e:6917)
what does this error mean?
This functions not will work correctly
please changing a variable like this
var allparts = parts+1; for (var i = 0; i < allparts; i ++) { partInfo[i] = { number: i + 1, start: i * splitSize, end: (i * splitSize) + splitSize }; if (i === (allparts - 1)) { partInfo[i].end = (i * splitSize) + lastSplitSize; } }
thank you
const { splitFile } = require('split-file')
const uploadFile = (file) => {
return new Promise((resolve, reject) => {
splitFile(file.path, 2)
.then((filePiecesPaths) => {
console.log(filePiecesPaths)
})
.catch((error) => {
console.error(error);
reject('Could not split file')
})
})
}
Hi.
I am developing using the module you wrote. But there is one point I'm hanging out with. Could there be anything wrong with the module? I am waiting for your help. Thanks.
My question:
http://stackoverflow.com/questions/40794598/split-video-file-to-stream-from-browser
3.5.3
to 3.5.4
.This version is covered by your current version range and after updating it in your project the build failed.
bluebird is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
The new version differs by 6 commits.
e0222e3
Release v3.5.4
4b9fa33
missing --expose-gc
flag (#1586)
63b15da
docs: improve and compare Promise.each and Promise.mapSeries (#1565)
9dcefe2
.md syntax fix for coming-from-other-languages.md (#1584)
b97c0d2
added proper version check supporting VSCode (#1576)
499cf8e
Update jsdelivr url in docs (#1571)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Overall code style improvements. Will be related to some commits in the future. Post any suggestions here.
See also the goal on Codacy: https://www.codacy.com/p/56014/goals?bid=4244335
Branch | Build failing 🚨 |
---|---|
Dependency | jest |
Current Version | 22.1.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Split by size (say at 1000000 bytes)
using this:
async function splitFile( filename, chunkSize ) {
return new Promise(( resolve, reject ) => {
split.splitFileBySize( __dirname + filename, chunkSize )
.then(names => {
resolve( names )
})
.catch(err => {
console.log("NEEEEEEEERRRRRR : ", err);
reject( err );
})
})
} // end splitFile
does this
-rw-r--r-- 1 staff 5.0M Oct 2 2017 abc123.mp4
-rw-r--r-- 1 staff 977K Oct 25 11:35 abc123.mp4.sf-part1
-rw-r--r-- 1 staff 4.0M Oct 25 11:35 abc123.mp4.sf-part2
-rw-r--r-- 1 staff 3.1M Oct 25 11:35 abc123.mp4.sf-part3
-rw-r--r-- 1 staff 2.1M Oct 25 11:35 abc123.mp4.sf-part4
-rw-r--r-- 1 staff 1.2M Oct 25 11:35 abc123.mp4.sf-part5
-rw-r--r-- 1 staff 232K Oct 25 11:35 abc123.mp4.sf-part6
Doesn't work on node v14
ReferenceError: parts is not defined
In module there is a line which I think is the problem
SplitFile.prototype.splitFileBySize = function(file, maxSize) {
var self = this;
// Validate parameters.
if (parts < 1) {
return Promise.reject(new Error("Parameter 'parts' is invalid, must contain an integer value."));
}
parts is not defined because it does not receive any parameter parts
just file
and maxSize
.
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Update the readme with the new Promise methods.
I think it would be nice to provide the 2.x versions with promises (callback + promise or promise only?). This will not only improve the compatibility with ES2015 styles, but also the integrations for the upcoming async await
syntax.
@purplecones How is your opinion about this, and related to your projects environment/integrations.
To make easy use of this library, provide typescript definitions
Branch | Build failing 🚨 |
---|---|
Dependency | bluebird |
Current Version | 3.5.1 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
bluebird is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
Bugfixes:
PromiseRejectionEvent
to contain .reason
and .promise
properties. (#1509, #1464)The new version differs by 22 commits.
50067ec
Release v3.5.2
f290da0
Fix memory being retained until promise queue is completely empty (#1544)
ad6d763
Update benchmarks (#1539)
49da1ac
Fix a typo. (#1534)
b06106a
Fix typo in readme introduced in #1530 (#1531)
c1dc5b9
Update README.md (#1530)
e35455f
chore: clone last 5 commits (#1521)
91ae9ce
chore: add Node.js 10 (#1523)
9159472
Added a simple usage example (#1369)
39081ba
Update promise.each.md (#1479)
77781fe
Fix header (#1513)
b8eedc1
Update LICENSE to 2018 (#1490)
4163e82
Added ES6 way to import the bluebird promise (#1461)
3790a92
DOC: add direct link to Promise.delay from API ref (#1465)
e8d8525
Update error documentation (#1469)
There are 22 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Why not... it's better
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.