GithubHelp home page GithubHelp logo

image-data-uri's People

Contributors

andyli avatar diegozoracky avatar iiska avatar joelabair avatar luizamboni 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  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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

image-data-uri's Issues

Proposal: Exceptions and Error Codes

It would be great for the module, when it encounters an error, to throw an Error object containing a documented error code.

This would enable user code to reliably try... catch each module method and handle each error type specifically. Currently, this is not possible, with each method returning null on error, and the error information being displayed separately with console.log.

I'd be happy to implement this myself but I don't currently have the time on my hands. So, I thought it prudent to raise the issue here as a matter of recordkeeping if nothing more.

By the way, thanks to @DiegoZoracKy for providing this module. It's great. 👍

License

Hi, is there a license associated with this repo? I want to use it in a project.

DeprecationWarning

Thanks for your work, for information:

Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

import errpr

I just import.
I use react-creat-apps. it is JS. not typescript

import { ImageDataURI } from 'image-data-uri';

or

import ImageDataURI from 'image-data-uri';

but

×
TypeError: Cannot read property 'toString' of undefined
(anonymous function)
node_modules/graceful-fs/graceful-fs.js:66
  63 | // versions of graceful-fs are installed.
  64 | 
  65 | 
> 66 | if (!/\bgraceful-fs\b/.test(fs.closeSync.toString())) {
  67 |   fs.closeSync = module.exports.closeSync;
  68 |   fs.close = module.exports.close;
  69 | }
View compiled
./node_modules/graceful-fs/graceful-fs.js
http://localhost:3001/static/js/1.chunk.js:38906:30
__webpack_require__
/Users/username/pdfmake_sample/webpack/bootstrap:782
  779 | };
  780 | 
  781 | // Execute the module function
> 782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  783 | 
  784 | // Flag the module as loaded
  785 | module.l = true;
View compiled
fn
/Users/username/pdfmake_sample/webpack/bootstrap:150
  147 | 		);
  148 | 		hotCurrentParents = [];
  149 | 	}
> 150 | 	return __webpack_require__(request);
      | ^  151 | };
  152 | var ObjectFactory = function ObjectFactory(name) {
  153 | 	return {
View compiled
./node_modules/image-data-uri/node_modules/fs-extra/lib/index.js
node_modules/image-data-uri/node_modules/fs-extra/lib/index.js:5
__webpack_require__
/Users/username/pdfmake_sample/webpack/bootstrap:782
  779 | };
  780 | 
  781 | // Execute the module function
> 782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  783 | 
  784 | // Flag the module as loaded
  785 | module.l = true;
View compiled
fn
/Users/username/pdfmake_sample/webpack/bootstrap:150
  147 | 		);
  148 | 		hotCurrentParents = [];
  149 | 	}
> 150 | 	return __webpack_require__(request);
      | ^  151 | };
  152 | var ObjectFactory = function ObjectFactory(name) {
  153 | 	return {
View compiled
▶ 2 stack frames were collapsed.
__webpack_require__
/Users/username/pdfmake_sample/webpack/bootstrap:782
  779 | };
  780 | 
  781 | // Execute the module function
> 782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  783 | 
  784 | // Flag the module as loaded
  785 | module.l = true;
View compiled
fn
/Users/username/pdfmake_sample/webpack/bootstrap:150
  147 | 		);
  148 | 		hotCurrentParents = [];
  149 | 	}
> 150 | 	return __webpack_require__(request);
      | ^  151 | };
  152 | var ObjectFactory = function ObjectFactory(name) {
  153 | 	return {
View compiled
Module../src/App.js
http://localhost:3001/static/js/main.chunk.js:139:73
__webpack_require__
/Users/username/pdfmake_sample/webpack/bootstrap:782
  779 | };
  780 | 
  781 | // Execute the module function
> 782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  783 | 
  784 | // Flag the module as loaded
  785 | module.l = true;
View compiled
fn
/Users/username/pdfmake_sample/webpack/bootstrap:150
  147 | 		);
  148 | 		hotCurrentParents = [];
  149 | 	}
> 150 | 	return __webpack_require__(request);
      | ^  151 | };
  152 | var ObjectFactory = function ObjectFactory(name) {
  153 | 	return {
View compiled
Module../src/index.js
http://localhost:3001/static/js/main.chunk.js:578:62
__webpack_require__
/Users/username/pdfmake_sample/webpack/bootstrap:782
  779 | };
  780 | 
  781 | // Execute the module function
> 782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  783 | 
  784 | // Flag the module as loaded
  785 | module.l = true;
View compiled
fn
/Users/username/pdfmake_sample/webpack/bootstrap:150
  147 | 		);
  148 | 		hotCurrentParents = [];
  149 | 	}
> 150 | 	return __webpack_require__(request);
      | ^  151 | };
  152 | var ObjectFactory = function ObjectFactory(name) {
  153 | 	return {
View compiled
0
http://localhost:3001/static/js/main.chunk.js:705:18
__webpack_require__
/Users/username/pdfmake_sample/webpack/bootstrap:782
  779 | };
  780 | 
  781 | // Execute the module function
> 782 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  783 | 
  784 | // Flag the module as loaded
  785 | module.l = true;
View compiled
checkDeferredModules
/Users/username/pdfmake_sample/webpack/bootstrap:45
  42 | 	}
  43 | 	if(fulfilled) {
  44 | 		deferredModules.splice(i--, 1);
> 45 | 		result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
     | ^  46 | 	}
  47 | }
  48 | return result;
View compiled
Array.webpackJsonpCallback [as push]
/Users/username/pdfmake_sample/webpack/bootstrap:32
  29 | 	deferredModules.push.apply(deferredModules, executeModules || []);
  30 | 
  31 | 	// run deferred modules when all chunks ready
> 32 | 	return checkDeferredModules();
     | ^  33 | };
  34 | function checkDeferredModules() {
  35 | 	var result;
View compiled
(anonymous function)
http://localhost:3001/static/js/main.chunk.js:1:57
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.

Issue with the methods

I tried to use this package but I kept getting error that the method was apparently not a function , I tried to look things up on my side but it seems like nothing is working . Could you help me please.

decode returns imageType as "image/xxx"

README says decode() returns something like imageType: 'png', but in reality, it is imageType: 'image/png'.

The regexp should be changed from (image/.*) to image/(.*) in

let regExMatches = dataURI.match('data:(image/.*);base64,(.*)');
return {
imageType: regExMatches[1],
dataBase64: regExMatches[2],
dataBuffer: new Buffer(regExMatches[2], 'base64')
};

no typescript

> npm install @types/image-data-uri
npm ERR! code E404
npm ERR! 404 Not Found: @types/image-data-uri@latest

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2018-12-07T09_14_06_266Z-debug.log

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.