filepond-plugin-file-encode
Advanced tools
Comparing version
@@ -1,2 +0,6 @@ | ||
/* filepond-plugin-file-encode 1.0.0 https://pqina.nl/filepond */ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.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,o=i.Type,a=i.createWorker,d=i.createRoute;t("SET_DEFAULT_OPTIONS",function(e){return Object.assign(e,{allowFileEncode:[!0,o.BOOLEAN]})}),t("CREATE_VIEW",function(n){var t=n.is,i=n.view,o=n.query;if(t("file")&&o("GET_ALLOW_FILE_ENCODE")){var l=function(n){var t=n.root,i=n.action;if(!o("IS_ASYNC")){var d=o("GET_ITEM",i.id);a(e).post({file:d.getFileBlob()},function(e){t.ref.dataContainer.value=JSON.stringify({id:d.getId(),name:d.getFilename(),type:d.getFileType(),size:d.getFileSize(),data:e})})}};i.registerWriter(d({DID_LOAD_ITEM:l}))}})};return document&&(document.addEventListener("FilePond:loaded",function(e){console.log("filepond loaded"),e.detail.registerPlugin(n)}),document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:n}))),n}); | ||
/* | ||
* FilePondPluginFileEncode 1.0.1 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT | ||
* Please visit https://pqina.nl/filepond for details. | ||
*/ | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):e.FilePondPluginFileEncode=i()}(this,function(){"use strict";var e=function(){self.onmessage=function(i){e(i.data.message,function(e){self.postMessage({id:i.data.id,message:e})})};var e=function(e,i){var n=e.file,t=new FileReader;t.onloadend=function(){i(t.result.replace("data:","").replace(/^.+,/,""))},t.readAsDataURL(n)}},i=function(i){var n=i.addFilter,t=i.utils,a=t.Type,o=t.createWorker,d=t.createRoute;n("SET_DEFAULT_OPTIONS",function(e){return Object.assign(e,{allowFileEncode:[!0,a.BOOLEAN]})}),n("CREATE_VIEW",function(i){var n=i.is,t=i.view,a=i.query;if(n("file")&&a("GET_ALLOW_FILE_ENCODE")){var r=function(i){var n=i.root,t=i.action;if(!a("IS_ASYNC")){var d=a("GET_ITEM",t.id);o(e).post({file:d.file},function(e){n.ref.dataContainer.value=JSON.stringify({id:d.id,name:d.filename,type:d.fileType,size:d.fileSize,data:e})})}};t.registerWriter(d({DID_LOAD_ITEM:r}))}})};return document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:i})),i}); |
@@ -1,2 +0,6 @@ | ||
/* filepond-plugin-file-encode 1.0.0 https://pqina.nl/filepond */ | ||
const DataURIWorker=function(){self.onmessage=(t=>{e(t.data.message,e=>{self.postMessage({id:t.data.id,message:e})})});const e=(e,t)=>{const{file:a}=e,i=new FileReader;i.onloadend=(()=>{t(i.result.replace("data:","").replace(/^.+,/,""))}),i.readAsDataURL(a)}};var plugin$1=({addFilter:e,utils:t})=>{const{Type:a,createWorker:i,createRoute:n}=t;e("SET_DEFAULT_OPTIONS",e=>Object.assign(e,{allowFileEncode:[!0,a.BOOLEAN]})),e("CREATE_VIEW",e=>{const{is:t,view:a,query:l}=e;if(!t("file")||!l("GET_ALLOW_FILE_ENCODE"))return;a.registerWriter(n({DID_LOAD_ITEM:({root:e,action:t})=>{if(l("IS_ASYNC"))return;const a=l("GET_ITEM",t.id);i(DataURIWorker).post({file:a.getFileBlob()},t=>{e.ref.dataContainer.value=JSON.stringify({id:a.getId(),name:a.getFilename(),type:a.getFileType(),size:a.getFileSize(),data:t})})}}))})};document&&(document.addEventListener("FilePond:loaded",e=>{console.log("filepond loaded"),e.detail.registerPlugin(plugin$1)}),document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:plugin$1})));export default plugin$1; | ||
/* | ||
* FilePondPluginFileEncode 1.0.1 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT | ||
* Please visit https://pqina.nl/filepond for details. | ||
*/ | ||
const DataURIWorker=function(){self.onmessage=(t=>{e(t.data.message,e=>{self.postMessage({id:t.data.id,message:e})})});const e=(e,t)=>{const{file:a}=e,i=new FileReader;i.onloadend=(()=>{t(i.result.replace("data:","").replace(/^.+,/,""))}),i.readAsDataURL(a)}};var plugin$1=({addFilter:e,utils:t})=>{const{Type:a,createWorker:i,createRoute:n}=t;e("SET_DEFAULT_OPTIONS",e=>Object.assign(e,{allowFileEncode:[!0,a.BOOLEAN]})),e("CREATE_VIEW",e=>{const{is:t,view:a,query:r}=e;if(!t("file")||!r("GET_ALLOW_FILE_ENCODE"))return;a.registerWriter(n({DID_LOAD_ITEM:({root:e,action:t})=>{if(r("IS_ASYNC"))return;const a=r("GET_ITEM",t.id);i(DataURIWorker).post({file:a.file},t=>{e.ref.dataContainer.value=JSON.stringify({id:a.id,name:a.filename,type:a.fileType,size:a.fileSize,data:t})})}}))})};document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:plugin$1}));export default plugin$1; |
{ | ||
"name": "filepond-plugin-file-encode", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "File Encoding Plugin for FilePond", | ||
@@ -5,0 +5,0 @@ "homepage": "https://pqina.nl/filepond", |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
10
400%3936
-2.84%