Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6114589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:59:32+00:00 2026-05-23T14:59:32+00:00

I am trying to slice a big file as follows: function alertChunk(file) { var

  • 0

I am trying to slice a big file as follows:

function alertChunk(file) {
    var reader = new FileReader();

    reader.onloadend = function(e) {
        if (e.target.readyState == FileReader.DONE) {
            alert(e.target.result);
        }
    };

    if (file.slice) {
        var blob = file.slice(1000, 1000);
    } else if (file.mozSlice) {
        var blob = file.mozSlice(1000, 1000);
    } else if (file.webkitSlice) {
        var blob = file.webkitSlice(1000, 1000);
    }

    reader.readAsBinaryString(blob);
}

HTML as follows:

<input type="file" onchange="alertChunk(this.files[0])" />

But I do get an empty result in Chrome, though it works well in Firefox. Does anybody know why it can be empty? What is wrong?

NB: It seems to work well in Chrome when I do as follows:

var blob = file.webkitSlice(10, 1000); // changed the start index

But it won’t work with a bigger index!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:59:33+00:00Added an answer on May 23, 2026 at 2:59 pm

    The FileReader interface is part of the W3C File API that is still just a working draft so you can expect it to be inconsistenly implemented across browsers.

    ECMA-262 specifies slice as String.prototype.slice(start, end) where start and end reference characters in a string. I expect that if start == end then nothing will be sliced.

    The W3C File API working draft specifies File.slice(start, length[, contentType]) where start and length are byte offsets. The optional contentType parameter may allow setting the content to ASCII text or similar.

    So it appears that Chrome’s File.slice may well be implemented per the ECMA-262 String method rather than the W3C File API method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Python. Here's what I am trying to do: Slice a
I'm trying to deploy to a slicehost slice using this config/deploy/production.rb file. I'm clueless
I was trying to create an extension that could slice any array-like class (since
I am trying to implement slice functionality for a class I am making that
I'm trying to build a simple JQ Plugin with input and a button: (function
I'm trying to create a map in Go that is keyed by big integers.
Trying to upload my django app on my obunto slice. The problem I'm facing
I'm trying to replicate CI's humanize() and underscore() function in Javascript. From the CI
I am trying to slice the last four characters off a character array, and
I'm trying to slice a list (call this input list & it contains Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.