Advertisement
jackluciano

Untitled

Feb 22nd, 2024
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. protected EncodeFile(FileSource: string, FileTarget: string): { Key: string; Iv: string } {
  2. const EncrypterExecutablePath = path.join(ProjectRelativeResourcePath, "_scripts/vendor/encrypter.exe");
  3.  
  4. const Key = GenerateRandomString(16),
  5. IVKey = GenerateRandomString(16);
  6.  
  7. const SourceRelative = Normalize(path.relative(Deno.cwd(), FileSource)),
  8. TargetRelative = Normalize(path.relative(Deno.cwd(), FileTarget)),
  9. OutPath = path.resolve(FileTarget, "../");
  10.  
  11. console.log(SourceRelative)
  12. if (!fs.existsSync(OutPath)) fs.mkdirSync(OutPath, { recursive: true });
  13.  
  14. spawnSync(EncrypterExecutablePath, [SourceRelative, TargetRelative, IVKey, Key], {
  15. cwd: Deno.cwd(),
  16. stdio: "inherit",
  17. });
  18.  
  19. return { Key: Key, Iv: IVKey };
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement