forked from noxious/server
😂🔫
This commit is contained in:
@ -32,9 +32,9 @@ export default function (socket: TSocket, io: Server) {
|
||||
for (const key in data) {
|
||||
// the files in the folder are named 0.png, 1.png, 2.png etc... check the last file name and add 1
|
||||
const files = fs.readdirSync(public_folder);
|
||||
const lastFile = files[files.length - 1];
|
||||
const lastFile = files.reduce((a, b) => a > b ? a : b);
|
||||
const lastFileName = lastFile?.split('.')[0];
|
||||
const filename = `${parseInt(lastFileName ?? 0) + 1}.png`;
|
||||
const filename = `${parseInt(lastFileName ?? '0') + 1}.png`;
|
||||
const finalFilePath = path.join(public_folder, filename);
|
||||
const tile = data[key];
|
||||
|
||||
|
Reference in New Issue
Block a user