diegozoracky / image-data-uri Goto Github PK
View Code? Open in Web Editor NEWLibrary to easily decode/encode Data URI images
Library to easily decode/encode Data URI images
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. 👍
Low Prototype Pollution
Package yargs-parser
Patched in >=13.1.2 <14.0.0 || >=15.0.1 <16.0.0 || >=18.1.2
Dependency of image-data-uri
Path image-data-uri > magicli > cliss > yargs-parser
More info https://npmjs.com/advisories/1500
Proposed solution: Update magicli to use cliss 0.0.9 and image-data-uri to use this fixed magicli
Hi, is there a license associated with this repo? I want to use it in a project.
I think you need to include the lib/image-data-uri.d.ts
image in your published package for the types to be available. I see them in the repo, but yarn doesn't think there's any types available.
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.
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.
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.
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
image-data-uri/lib/image-data-uri.js
Lines 24 to 29 in af2fa12
> 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
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.