PageSourceSearch

https://www.aipictors.com/assets/download-image-file-as-png.js

js aipictors.com collected 2026-09-24 09:42:25 UTC 1,301 bytes, 1 lines download raw bytes

1import{f as m,g as w}from"./fetch-public.js";async function b(n){try{const s=await(await m(w(n.url))).blob(),o=n.extension||"png",a=URL.createObjectURL(s),r=new Image;r.src=a,await new Promise((l,c)=>{r.onload=()=>l(),r.onerror=()=>c(new Error("画像の読み込みに失敗しました。"))});const e=document.createElement("canvas");e.width=r.width,e.height=r.height;const i=e.getContext("2d");i==null||i.drawImage(r,0,0),URL.revokeObjectURL(a);const d=await(await new Promise(l=>{e.toBlob(c=>{if(c)l(c);else throw new Error("画像の変換に失敗しました。")},`image/${o}`)})).arrayBuffer();return{name:`${n.name?n.name:"file"}.${o}`,data:new Uint8Array(d)}}catch(t){throw console.error(t),new Error("ファイルの取得に失敗しました。")}}function f(n){return n.replace(/[\\/:*?"<>|]/g,"_")}const u=async(n,t)=>{if(!t){console.error("画像が存在しません");return}const s=f(n||"file");try{const o=await b({url:t,name:s,extension:"png"}),a=new Uint8Array(o.data.byteLength);a.set(o.data);const r=new Blob([a],{type:"image/png"}),e=document.createElement("a");e.href=URL.createObjectURL(r),e.download=o.name,e.rel="noopener",document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(e.href)}catch(o){console.error(o)}};export{b as c,u as d};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.