Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

filepond-plugin-file-encode

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filepond-plugin-file-encode - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

18

dist/filepond-plugin-file-encode.esm.js
/*!
* FilePondPluginFileEncode 2.1.4
* FilePondPluginFileEncode 2.1.5
* Licensed under MIT, https://opensource.org/licenses/MIT/

@@ -117,4 +117,4 @@ * Please visit https://pqina.nl/filepond/ for details.

// create JSON string from encoded data and stores in the hidden input field
root.ref.data.value = JSON.stringify({
// create JSON string from encoded data
const value = JSON.stringify({
id: item.id,

@@ -127,2 +127,14 @@ name: item.file.name,

});
// for filepond < 4.13.0
if (root.ref.data) {
root.ref.data.value = value;
}
// newer versions
else {
root.dispatch('DID_DEFINE_VALUE', {
id: item.id,
value
});
}
},

@@ -129,0 +141,0 @@ DID_REMOVE_ITEM: ({ action }) => {

4

dist/filepond-plugin-file-encode.esm.min.js
/*!
* FilePondPluginFileEncode 2.1.4
* FilePondPluginFileEncode 2.1.5
* Licensed under MIT, https://opensource.org/licenses/MIT/

@@ -9,2 +9,2 @@ * Please visit https://pqina.nl/filepond/ for details.

const e=function(){self.onmessage=(a=>{e(a.data.message,e=>{self.postMessage({id:a.data.id,message:e})})});const e=(e,a)=>{const{file:t}=e,i=new FileReader;i.onloadend=(()=>{a(i.result.replace("data:","").replace(/^.+,/,""))}),i.readAsDataURL(t)}},a=({addFilter:a,utils:t})=>{const{Type:i,createWorker:n,createRoute:d,isFile:o}=t,E=({name:a,file:t})=>new Promise(i=>{const d=n(e);d.post({file:t},e=>{i({name:a,data:e}),d.terminate()})}),r=[];return a("DID_CREATE_ITEM",(e,{query:a})=>{a("GET_ALLOW_FILE_ENCODE")&&(e.extend("getFileEncodeBase64String",()=>r[e.id].data),e.extend("getFileEncodeDataURL",()=>`data:${e.fileType};base64,${r[e.id].data}`))}),a("SHOULD_PREPARE_OUTPUT",(e,{query:a})=>new Promise(e=>{e(a("GET_ALLOW_FILE_ENCODE"))})),a("COMPLETE_PREPARE_OUTPUT",(e,{item:a,query:t})=>new Promise(i=>{if(!t("GET_ALLOW_FILE_ENCODE")||!o(e)&&!Array.isArray(e))return i(e);r[a.id]={metadata:a.getMetadata(),data:null},Promise.all((e instanceof Blob?[{name:null,file:e}]:e).map(E)).then(t=>{r[a.id].data=e instanceof Blob?t[0].data:t,i(e)})})),a("CREATE_VIEW",e=>{const{is:a,view:t,query:i}=e;a("file-wrapper")&&i("GET_ALLOW_FILE_ENCODE")&&t.registerWriter(d({DID_PREPARE_OUTPUT:({root:e,action:a})=>{if(i("IS_ASYNC"))return;const t=i("GET_ITEM",a.id);if(!t)return;const n=r[t.id],d=n.metadata,o=n.data;e.ref.data.value=JSON.stringify({id:t.id,name:t.file.name,type:t.file.type,size:t.file.size,metadata:d,data:o})},DID_REMOVE_ITEM:({action:e})=>{const a=i("GET_ITEM",e.id);a&&delete r[a.id]}}))}),{options:{allowFileEncode:[!0,i.BOOLEAN]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:a}));export default a;
const e=function(){self.onmessage=(a=>{e(a.data.message,e=>{self.postMessage({id:a.data.id,message:e})})});const e=(e,a)=>{const{file:t}=e,i=new FileReader;i.onloadend=(()=>{a(i.result.replace("data:","").replace(/^.+,/,""))}),i.readAsDataURL(t)}},a=({addFilter:a,utils:t})=>{const{Type:i,createWorker:d,createRoute:n,isFile:E}=t,o=({name:a,file:t})=>new Promise(i=>{const n=d(e);n.post({file:t},e=>{i({name:a,data:e}),n.terminate()})}),r=[];return a("DID_CREATE_ITEM",(e,{query:a})=>{a("GET_ALLOW_FILE_ENCODE")&&(e.extend("getFileEncodeBase64String",()=>r[e.id].data),e.extend("getFileEncodeDataURL",()=>`data:${e.fileType};base64,${r[e.id].data}`))}),a("SHOULD_PREPARE_OUTPUT",(e,{query:a})=>new Promise(e=>{e(a("GET_ALLOW_FILE_ENCODE"))})),a("COMPLETE_PREPARE_OUTPUT",(e,{item:a,query:t})=>new Promise(i=>{if(!t("GET_ALLOW_FILE_ENCODE")||!E(e)&&!Array.isArray(e))return i(e);r[a.id]={metadata:a.getMetadata(),data:null},Promise.all((e instanceof Blob?[{name:null,file:e}]:e).map(o)).then(t=>{r[a.id].data=e instanceof Blob?t[0].data:t,i(e)})})),a("CREATE_VIEW",e=>{const{is:a,view:t,query:i}=e;a("file-wrapper")&&i("GET_ALLOW_FILE_ENCODE")&&t.registerWriter(n({DID_PREPARE_OUTPUT:({root:e,action:a})=>{if(i("IS_ASYNC"))return;const t=i("GET_ITEM",a.id);if(!t)return;const d=r[t.id],n=d.metadata,E=d.data,o=JSON.stringify({id:t.id,name:t.file.name,type:t.file.type,size:t.file.size,metadata:n,data:E});e.ref.data?e.ref.data.value=o:e.dispatch("DID_DEFINE_VALUE",{id:t.id,value:o})},DID_REMOVE_ITEM:({action:e})=>{const a=i("GET_ITEM",e.id);a&&delete r[a.id]}}))}),{options:{allowFileEncode:[!0,i.BOOLEAN]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:a}));export default a;
/*!
* FilePondPluginFileEncode 2.1.4
* FilePondPluginFileEncode 2.1.5
* Licensed under MIT, https://opensource.org/licenses/MIT/

@@ -147,4 +147,4 @@ * Please visit https://pqina.nl/filepond/ for details.

// create JSON string from encoded data and stores in the hidden input field
root.ref.data.value = JSON.stringify({
// create JSON string from encoded data
var value = JSON.stringify({
id: item.id,

@@ -157,2 +157,14 @@ name: item.file.name,

});
// for filepond < 4.13.0
if (root.ref.data) {
root.ref.data.value = value;
}
// newer versions
else {
root.dispatch('DID_DEFINE_VALUE', {
id: item.id,
value: value
});
}
},

@@ -159,0 +171,0 @@ DID_REMOVE_ITEM: function DID_REMOVE_ITEM(_ref7) {

/*!
* FilePondPluginFileEncode 2.1.4
* FilePondPluginFileEncode 2.1.5
* Licensed under MIT, https://opensource.org/licenses/MIT/

@@ -9,2 +9,2 @@ * Please visit https://pqina.nl/filepond/ for details.

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).FilePondPluginFileEncode=n()}(this,function(){"use strict";var e=function(){self.onmessage=function(n){e(n.data.message,function(e){self.postMessage({id:n.data.id,message:e})})};var e=function(e,n){var t=e.file,i=new FileReader;i.onloadend=function(){n(i.result.replace("data:","").replace(/^.+,/,""))},i.readAsDataURL(t)}},n=function(n){var t=n.addFilter,i=n.utils,a=i.Type,o=i.createWorker,r=i.createRoute,d=i.isFile,f=function(n){var t=n.name,i=n.file;return new Promise(function(n){var a=o(e);a.post({file:i},function(e){n({name:t,data:e}),a.terminate()})})},u=[];return t("DID_CREATE_ITEM",function(e,n){(0,n.query)("GET_ALLOW_FILE_ENCODE")&&(e.extend("getFileEncodeBase64String",function(){return u[e.id].data}),e.extend("getFileEncodeDataURL",function(){return"data:".concat(e.fileType,";base64,").concat(u[e.id].data)}))}),t("SHOULD_PREPARE_OUTPUT",function(e,n){var t=n.query;return new Promise(function(e){e(t("GET_ALLOW_FILE_ENCODE"))})}),t("COMPLETE_PREPARE_OUTPUT",function(e,n){var t=n.item,i=n.query;return new Promise(function(n){if(!i("GET_ALLOW_FILE_ENCODE")||!d(e)&&!Array.isArray(e))return n(e);u[t.id]={metadata:t.getMetadata(),data:null},Promise.all((e instanceof Blob?[{name:null,file:e}]:e).map(f)).then(function(i){u[t.id].data=e instanceof Blob?i[0].data:i,n(e)})})}),t("CREATE_VIEW",function(e){var n=e.is,t=e.view,i=e.query;n("file-wrapper")&&i("GET_ALLOW_FILE_ENCODE")&&t.registerWriter(r({DID_PREPARE_OUTPUT:function(e){var n=e.root,t=e.action;if(!i("IS_ASYNC")){var a=i("GET_ITEM",t.id);if(a){var o=u[a.id],r=o.metadata,d=o.data;n.ref.data.value=JSON.stringify({id:a.id,name:a.file.name,type:a.file.type,size:a.file.size,metadata:r,data:d})}}},DID_REMOVE_ITEM:function(e){var n=e.action,t=i("GET_ITEM",n.id);t&&delete u[t.id]}}))}),{options:{allowFileEncode:[!0,a.BOOLEAN]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:n})),n});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).FilePondPluginFileEncode=n()}(this,function(){"use strict";var e=function(){self.onmessage=function(n){e(n.data.message,function(e){self.postMessage({id:n.data.id,message:e})})};var e=function(e,n){var t=e.file,a=new FileReader;a.onloadend=function(){n(a.result.replace("data:","").replace(/^.+,/,""))},a.readAsDataURL(t)}},n=function(n){var t=n.addFilter,a=n.utils,i=a.Type,o=a.createWorker,d=a.createRoute,r=a.isFile,f=function(n){var t=n.name,a=n.file;return new Promise(function(n){var i=o(e);i.post({file:a},function(e){n({name:t,data:e}),i.terminate()})})},u=[];return t("DID_CREATE_ITEM",function(e,n){(0,n.query)("GET_ALLOW_FILE_ENCODE")&&(e.extend("getFileEncodeBase64String",function(){return u[e.id].data}),e.extend("getFileEncodeDataURL",function(){return"data:".concat(e.fileType,";base64,").concat(u[e.id].data)}))}),t("SHOULD_PREPARE_OUTPUT",function(e,n){var t=n.query;return new Promise(function(e){e(t("GET_ALLOW_FILE_ENCODE"))})}),t("COMPLETE_PREPARE_OUTPUT",function(e,n){var t=n.item,a=n.query;return new Promise(function(n){if(!a("GET_ALLOW_FILE_ENCODE")||!r(e)&&!Array.isArray(e))return n(e);u[t.id]={metadata:t.getMetadata(),data:null},Promise.all((e instanceof Blob?[{name:null,file:e}]:e).map(f)).then(function(a){u[t.id].data=e instanceof Blob?a[0].data:a,n(e)})})}),t("CREATE_VIEW",function(e){var n=e.is,t=e.view,a=e.query;n("file-wrapper")&&a("GET_ALLOW_FILE_ENCODE")&&t.registerWriter(d({DID_PREPARE_OUTPUT:function(e){var n=e.root,t=e.action;if(!a("IS_ASYNC")){var i=a("GET_ITEM",t.id);if(i){var o=u[i.id],d=o.metadata,r=o.data,f=JSON.stringify({id:i.id,name:i.file.name,type:i.file.type,size:i.file.size,metadata:d,data:r});n.ref.data?n.ref.data.value=f:n.dispatch("DID_DEFINE_VALUE",{id:i.id,value:f})}}},DID_REMOVE_ITEM:function(e){var n=e.action,t=a("GET_ITEM",n.id);t&&delete u[t.id]}}))}),{options:{allowFileEncode:[!0,i.BOOLEAN]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:n})),n});
{
"name": "filepond-plugin-file-encode",
"version": "2.1.4",
"version": "2.1.5",
"description": "File Encoding Plugin for FilePond",

@@ -5,0 +5,0 @@ "license": "MIT",

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