Skip to content

Instantly share code, notes, and snippets.

View StianWiu's full-sized avatar

Pignuuu StianWiu

View GitHub Profile
@StianWiu
StianWiu / Rename.js
Created November 13, 2021 18:29
Renames all files with certain file extension with increasing number on the end.
//requiring path and fs modules
const path = require("path");
const fs = require("fs");
//joining path of directory
const directoryPath = path.join(__dirname, "/");
//passsing directoryPath and callback function
fs.readdir(directoryPath, function (err, files) {
//handling error
if (err) {
return console.log("Unable to scan directory: " + err);
@StianWiu
StianWiu / Simple nodejs webhook meant for use in terminal
Last active March 27, 2022 13:27
This code will take in arguments like --name so you can customize what to send from your terminal
import { Webhook, MessageBuilder } from 'discord-webhook-node';
const hook = new Webhook("DISCORD WEBHOOK HERE"); // Change this to your webhook. (this is a example url, it doesn't work)
import { Command } from "commander";
const program = new Command();
program.option("-n, --name <string>"); // You can add more options here following the same format.
program.option("-z, --size <string>");
program.option("-f, --path <string>");