Giter Site home page Giter Site logo

Truncated binary file about node-split-file HOT 4 CLOSED

tomvlk avatar tomvlk commented on May 30, 2024
Truncated binary file

from node-split-file.

Comments (4)

tomvlk avatar tomvlk commented on May 30, 2024 1

Hey @chiarelli.
I'm not exactly sure, but I think that the rounding needs to use ceil instead of floor here, and therefor is a bug.

I will look into this asap.
Do you have more information or a sample file for me?

from node-split-file.

tomvlk avatar tomvlk commented on May 30, 2024 1

@chiarelli Released 2.1.0 for fixing this issue. I've not pushed it as a bugfix as it's chaging some behaviour.

Thanks for posting this issue!.

from node-split-file.

chiarelli avatar chiarelli commented on May 30, 2024

The truncation problem also occurs in text files when using the "splitFileBySize ()" method, but with the "splitFile ()" method this problem does not occur.

When I changed the code of the "splitFileBySize ()" method:

---
// Number of parts (exclusive last part!)
 var parts = Math.floor(totalSize / maxSize);
---

for:

---
 // Number of parts (exclusive last part!)
  var parts = (totalSize / maxSize);
---

The problem was apparently solved.
I believe that when size can not be rounded.

However, I believe it is more prudent to do more testing.

from node-split-file.

chiarelli avatar chiarelli commented on May 30, 2024

Any file (binary or not) when it is splitted using splitFileBySize() and then merged results in a truncated file.

As an example you could try a zip file. As an example you could try a zip file: split it and then merge it, will result in a truncated file and different from the original (you will not be able to unzip it).

from node-split-file.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.