New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

meta-png

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meta-png - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

dist/meta-png.umd.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MetaPNG={})}(this,(function(e){"use strict";function t(e){const t=new ArrayBuffer(4),n=new DataView(t);return n.setUint32(0,e),new Uint8Array(n.buffer)}function n(e,t=0,n=e.byteLength){let r="";const a=Math.min(n,e.byteLength-t);for(let n=0;n<a;n+=1)r+=String.fromCharCode(e.getUint8(t+n));return r}function r(e){return(new TextEncoder).encode(e)}function a(e){const t=e.reduce(((e,t)=>e+t.byteLength),0),n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t+=1)n.set(e[t],r),r+=e[t].byteLength;return n}function o(e){const t=new DataView(new Uint8Array([137,80,78,71,13,10,26,10]).buffer),n=new DataView(e.buffer,0,8);return t.getBigUint64()===n.getBigUint64()}function i(e,n,i){if(!o(e))throw new TypeError("Invalid PNG");if(n.length<1||n.length>79)throw new TypeError("Invalid length for key");const f=r("tEXt"),u=r(`${n}\0${i}`),g=t(0),s=a([t(u.byteLength),f,u,g]),c=16+new DataView(e.buffer,8,4).getUint32()+4;return a([e.subarray(0,c),s,e.subarray(c)])}e.addMetadata=i,e.addMetadataFromBase64DataURI=function(e,t,r){const a="data:image/png;base64,";if("string"!=typeof e||e.substring(0,a.length)!==a)throw new TypeError("Invalid PNG as Base64 Data URI");const o=atob(e.substring(a.length)),f=new Uint8Array(o.length);for(let e=0;e<o.length;e+=1)f[e]=o.charCodeAt(e);const u=i(f,t,r);return a+btoa(n(new DataView(u.buffer)))},e.getMetadata=function(e,t){if(!o(e))throw new TypeError("Invalid PNG");const r=new DataView(e.buffer);let a=8;for(;a<r.byteLength;){const e=r.getUint32(a);if(n(r,a+4,4+t.length)===`tEXt${t}`)return n(r,a+4+4+t.length+1,e-t.length-1);a+=e+12}},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MetaPNG={})}(this,(function(e){"use strict";function t(e){const t=new ArrayBuffer(4),n=new DataView(t);return n.setUint32(0,e),new Uint8Array(n.buffer)}function n(e,t=0,n=e.byteLength){let r="";const o=Math.min(n,e.byteLength-t);for(let n=0;n<o;n+=1)r+=String.fromCharCode(e.getUint8(t+n));return r}function r(e){return(new TextEncoder).encode(e)}function o(e){const t=e.reduce(((e,t)=>e+t.byteLength),0),n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t+=1)n.set(e[t],r),r+=e[t].byteLength;return n}function a(e){const t=new Uint8Array([137,80,78,71,13,10,26,10]);return!(e.length<t.length)&&t.every(((t,n)=>t===e[n]))}function i(e,n,i){if(!a(e))throw new TypeError("Invalid PNG");if(n.length<1||n.length>79)throw new TypeError("Invalid length for key");const f=r("tEXt"),u=r(`${n}\0${i}`),s=t(0),g=o([t(u.byteLength),f,u,s]),l=16+new DataView(e.buffer,8,4).getUint32()+4;return o([e.subarray(0,l),g,e.subarray(l)])}e.addMetadata=i,e.addMetadataFromBase64DataURI=function(e,t,r){const o="data:image/png;base64,";if("string"!=typeof e||e.substring(0,o.length)!==o)throw new TypeError("Invalid PNG as Base64 Data URI");const a=atob(e.substring(o.length)),f=new Uint8Array(a.length);for(let e=0;e<a.length;e+=1)f[e]=a.charCodeAt(e);const u=i(f,t,r);return o+btoa(n(new DataView(u.buffer)))},e.getMetadata=function(e,t){if(!a(e))throw new TypeError("Invalid PNG");const r=new DataView(e.buffer);let o=8;for(;o<r.byteLength;){const e=r.getUint32(o);if(n(r,o+4,4+t.length)===`tEXt${t}`)return n(r,o+4+4+t.length+1,e-t.length-1);o+=e+12}},Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "meta-png",
"version": "1.0.3",
"version": "1.0.4",
"description": "Write and read metadata in PNG files.",

@@ -5,0 +5,0 @@ "main": "dist/meta-png.umd.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc