remove manual main definitions
This commit is contained in:
@@ -13,16 +13,15 @@
|
||||
// TODO add sequentialPerPDF argument (which, when used, .shift()s pages from the beginning of PDFs)
|
||||
// TODO add chunkSize argument (default 1, which specifies how many pages in order to pull from a random PDF. value of -1 means take the whole PDF, and remove it from the list)
|
||||
// TODO make output page limit optional
|
||||
(function :Void main []
|
||||
(let [[sourceDir numPages] (Sys.args)]
|
||||
(loadAll (for file (Fs.readdirSync sourceDir) (+ sourceDir "/" file))
|
||||
(lambda [:Array<PDFDocument> inputPdfs]
|
||||
(awaitLet [saladPdf (PDFDocument.create)
|
||||
pages (Promise.all
|
||||
(for _ (range 0 (Std.parseInt numPages))
|
||||
(let [:PDFDocument pdf (nth inputPdfs (Std.random inputPdfs.length))
|
||||
page (Std.random (pdf.getPageCount))]
|
||||
(saladPdf.copyPages pdf [page]))))]
|
||||
(doFor page pages (saladPdf.addPage (first page)))
|
||||
(awaitLet [bytesOut (saladPdf.save)]
|
||||
(Fs.writeFileSync "out.pdf" bytesOut)))))))
|
||||
(let [[sourceDir numPages] (Sys.args)]
|
||||
(loadAll (for file (Fs.readdirSync sourceDir) (+ sourceDir "/" file))
|
||||
(lambda [:Array<PDFDocument> inputPdfs]
|
||||
(awaitLet [saladPdf (PDFDocument.create)
|
||||
pages (Promise.all
|
||||
(for _ (range 0 (Std.parseInt numPages))
|
||||
(let [:PDFDocument pdf (nth inputPdfs (Std.random inputPdfs.length))
|
||||
page (Std.random (pdf.getPageCount))]
|
||||
(saladPdf.copyPages pdf [page]))))]
|
||||
(doFor page pages (saladPdf.addPage (first page)))
|
||||
(awaitLet [bytesOut (saladPdf.save)]
|
||||
(Fs.writeFileSync "out.pdf" bytesOut))))))
|
||||
|
Reference in New Issue
Block a user