-
-
Save ashikka/f5411e3470e3dc4f15d1ae5a956d5791 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function downloadIt(link) { | |
| const image = await fetch(link); | |
| console.log(link); | |
| try { | |
| const img = await image.arrayBuffer(); | |
| const file = await fs.getFileForSaving("image.png"); | |
| await file.write(img); | |
| const currentDocument = app.activeDocument; | |
| const newDocument = await app.open(file); | |
| if (currentDocument) { | |
| await newDocument.activeLayers[0].duplicate(currentDocument); | |
| await newDocument.close(); | |
| } | |
| } catch (e) { | |
| console.log(e); | |
| } | |
| if (!file) { | |
| return; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment