Skip to content

Instantly share code, notes, and snippets.

View noodny's full-sized avatar
🚀

Krzysiek Jakubik noodny

🚀
  • NearForm
  • Zakopane, Poland
View GitHub Profile
@noodny
noodny / media-watch.js
Created July 29, 2021 17:23
Update samba shares as drives are mounted / unmounted on an RPi
import { readdirSync, watch, readFileSync, writeFileSync } from 'fs';
import { exec } from 'child_process';
const PATHNAME = '/media/pi';
const SMB_CONF = '/etc/samba/smb.conf';
let currentMedia = [];
function getMedia() {
return readdirSync(PATHNAME);