GithubHelp home page GithubHelp logo

blob's People

Contributors

devongovett avatar nevir avatar nkzawa avatar nulltask avatar panuhorsmalahti avatar rase- avatar rauchg avatar tootallnate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

blob's Issues

please improve the license info

Hi, I recently uploaded this Node.js module as a Debian package and we noticed that the license file is outdated. Can you please provide more details on the author(s) and the copyright holder(s)? This may seem a mundane task, but it makes the world better in protecting your work and the freedoms of the users. Many thanks, Paolo

version 0.0.5 in npm include jetbrains files

Kind of surprised there is a 0.0.5 version since it isn't a release in this repo. However 0.0.5 in npm include several development environment files. Shown in bold below.

$ tar -tzvf blob-0.0.5.tgz
-rw-rw-rw- 0/0 533 1985-10-26 03:15 package/package.json
-rw-rw-rw- 0/0 276 1985-10-26 03:15 package/.zuul.yml
-rw-rw-rw- 0/0 274 1985-10-26 03:15 package/component.json
-rw-rw-rw- 0/0 2531 1985-10-26 03:15 package/index.js
-rw-rw-rw- 0/0 1083 1985-10-26 03:15 package/LICENSE
-rw-rw-rw- 0/0 218 1985-10-26 03:15 package/Makefile
-rw-rw-rw- 0/0 326 1985-10-26 03:15 package/README.md
-rw-rw-rw- 0/0 469 1985-10-26 03:15 package/.idea/blob.iml
-rw-rw-rw- 0/0 128 1985-10-26 03:15 package/.idea/inspectionProfiles/profiles_settings.xml
-rw-rw-rw- 0/0 4796 1985-10-26 03:15 package/.idea/markdown-navigator.xml
-rw-rw-rw- 0/0 106 1985-10-26 03:15 package/.idea/markdown-navigator/profiles_settings.xml
-rw-rw-rw- 0/0 267 1985-10-26 03:15 package/.idea/modules.xml
-rw-rw-rw- 0/0 185 1985-10-26 03:15 package/.idea/vcs.xml
-rw-rw-rw- 0/0 16028 1985-10-26 03:15 package/.idea/workspace.xml

-rw-rw-rw- 0/0 3391 1985-10-26 03:15 package/test/index.js

Blob is not a constructor

I'm using Blob in node.js (v8.10.0) for creating a dummy file for the unit test. Below is my code

const Blob = require('blob');
let dummyFileData = new Uint8Array( [ 137, 80, 78, 71, 130 ] );
let dummyFileBlob = new Blob([ dummyFileData ], { type: 'image/png' });

image

push to npm

I'm kind of confused since this project has only 10 stars, while at the same time there have been "77.762 downloads in the last day" and the last update was "rase- published 2 years ago".

So it looks like this project has been picked up again after some time and a few things were update. Would be sick to call it 1.0.0 and publish to npm so people know they can use it. Thanks!

Fallback version for ie9 and others

Please consider adding this fallback version if blob is unsupported

function FakeBlobBuilder() {

  function toUTF8Array(str) {
    var utf8 = [];
    for (var i=0; i < str.length; i++) {
      var charcode = str.charCodeAt(i);
      if (charcode < 0x80) utf8.push(charcode);
      else if (charcode < 0x800) {
        utf8.push(0xc0 | (charcode >> 6), 
        0x80 | (charcode & 0x3f));
      }
      else if (charcode < 0xd800 || charcode >= 0xe000) {
        utf8.push(0xe0 | (charcode >> 12), 
        0x80 | ((charcode>>6) & 0x3f), 
        0x80 | (charcode & 0x3f));
      }
      // surrogate pair
      else {
        i++;
        // UTF-16 encodes 0x10000-0x10FFFF by
        // subtracting 0x10000 and splitting the
        // 20 bits of 0x0-0xFFFFF into two halves
        charcode = 0x10000 + (((charcode & 0x3ff)<<10)
        | (str.charCodeAt(i) & 0x3ff));
        utf8.push(0xf0 | (charcode >>18), 
        0x80 | ((charcode>>12) & 0x3f), 
        0x80 | ((charcode>>6) & 0x3f), 
        0x80 | (charcode & 0x3f));
      }
    }
    return utf8;
  }

  function Blob(chunks, opts) {
    for (var i = 0, len = chunks.length; i < len; i++) {
      var chunk = chunks[i]
      chunks[i] = 
        chunk instanceof Blob ? chunk._buffer :
        typeof chunk === 'string' ? toUTF8Array(chunk) : chunk
    }

    this._buffer = [].concat.apply([], chunks)
    this.size = this._buffer.length
    this.type = opts ? opts.type || '' : ''
  }

  Blob.prototype.slice = function(start, end, type) {
    var slice = this._buffer.slice(start || 0, end || this._buffer.length)
    return new Blob([slice], type || '')
  }

  Blob.prototype.toString = function() {
    return '[object Blob]'
  }

  if (typeof Symbol !== 'undefined') {
    Blob.prototype[Symbol.toStringTag] = 'Blob'
  }

  return Blob
}
module.exports = (function() {
  if (blobSupported) {
    return blobSupportsArrayBufferView ? global.Blob : BlobConstructor;
  } else if (blobBuilderSupported) {
    return BlobBuilderConstructor;
  } else {
    return FakeBlobBuilder();
  }
})();

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.