I decide to write a simple script to generate a search line for a booru that looks like this:
(@lower artist | @lower another_artist | @lower e.t.c) & feral
For that i have a list of artists stored in separate file and lets say it looks like this:
artist another_artist e.t.c
So basically what my script doing is putting all this artists together with some adjustments covered by brackets and with & feral line at the end then write it to clipboard. Scripts code (sorry for uglyness):
import { writeText } from "https://deno.land/x/copy_paste/mod.ts";
const q=await Deno.open('./list of artists'),
w=new Uint8Array(1e5)
await q.read(w)
const e=new TextDecoder().decode(w).split(' ').map(v=>' @lower '+v).join(' |'),
r=`(${e}) & feral`
console.log(r)
writeText(r)
So my deno is up to date and i run the script with the next command (im on windows):
deno run -A "%~dp0my script.js"
Then console.log part of the code gives me exactly what i need:
( @lower artist | @lower another_artist | @lower e.t.c) & feral
But then in my clipboard i can find only this:
( @lower artist | @lower another_artist | @lower e.t.c
I tried to throw away external library and write my generated string directly into another file with this code:
const q=await Deno.open('./list of artists'),
w=new Uint8Array(1e5)
await q.read(w)
const e=new TextDecoder().decode(w).split(' ').map(v=>' @lower '+v).join(' |'),
r=`(${e}) & feral`
console.log(r)
Deno.open('./output.txt',{write:true}).then(v=>v.write(new TextEncoder().encode(r)))
But shockingly result was exactly the same: console gives me correct string but writed string was cut out.
My next thought was that im running out of memory somehow or something and tried to reduce the number of artists in the list:
artist_one artist_two
And even more shockingly again my line was cropped before this last ) & feral:
( @lower artist_one | @lower artist_two
And console still giving me the correct line:
( @lower artist_one | @lower artist_two) & feral
Adding more artists in the list instead of reducing them giving the same resault.
So after further experiments its simply doesnt matter how long the list and its doesnt matter what are you trying to write before and after this modified list, behaviour always the same: script write everything that is going before modified list (in our case its () then its write modified list (@lower artist | @lower another_artist | @lower e.t.c) and then its ommit everything after () & feral in our example). Im stunned and dont know whats happening. Some help?