Skip to content

Instantly share code, notes, and snippets.

@Sarverott
Created April 18, 2025 06:18
Show Gist options
  • Save Sarverott/d0e7e4d483c06fc84c0b5c16dfe63561 to your computer and use it in GitHub Desktop.
Save Sarverott/d0e7e4d483c06fc84c0b5c16dfe63561 to your computer and use it in GitHub Desktop.
with darkpoint we trust that our member will be not lost...
/*
the Smeltry - included in Skriptonus and Blacksmith Organisation System
Copyright (C) 2025 Sett Sarverott A.A.B.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// on WAN with UNIXUSAT=1744956642598
import fs from "fs"
import path from "path"
// smeltry in modern javascript pronunciation with diacritic of Node.js environmentality
class Oath extends Promise{} // like our - it is made to proceed at background and to result be returned is needed to awaited, because it is process after all
// - to U.C.D.I. debatronics poetry log --
// for Artur and role of Canonkeeper
// to handle data growgh with care
// with memory optimised and think deeper
// for snapped knowledge to be share
// ---- from Sett Serverott --- 2025 ----
const SMELT = ( knowning_cube_jsonicated, SMELTING=true ) => new Oath(
(resolve) => fs.readFile(
knowning_cube_jsonicated,
(
reading_issues,
knowledge_snapshot
)=>fs.writeFile(
path.resolve(
path.dirname(knowning_cube_jsonicated),
[
path.basename(
knowning_cube_jsonicated,
(SMELTING)?".json":".darkpoint.json"
),
(!SMELTING)?".json":".darkpoint.json"
].join("")
),
JSON.stringify(
...(
[
JSON.parse(
knowledge_snapshot
)
].concat(
(!SMELTING)?[null,2]:[] //UNSMELT
)
)
),
(
writting_issues
)=>resolve(knowledge_snapshot)
)
)
)
//await SMELT("knowledgecubix.json"); // when keeping lots of data with safe preserverence is needed
//await SMELT("reknowingcube.darkpoint.json", false); // when will be readed as recollection with full greatness display
//const smeltryWasWritten = Date.parse("17 Apr 2025 08:53:20 GMT+0200");
//console.log(`UNIXUSAT=${ smeltryWasWritten }`); // OUTPUT: UNIXUSAT=1744872800000
export default SMELT;
// as it was created
/*
fs.readdir("__snapshoting",(er, files)=>{
for(var x of files){
console.log(SMELT(`./__snapshoting/${x}`))
}
})
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment