hotels-scraper-js
Version:
Parser for Airbnb, Booking, Hotels.com in JavaScript. Sponsored by SerpApi.
12 lines (9 loc) • 359 B
JavaScript
import fs from "fs/promises";
import path from "path";
function save(data, filename = "parsed_results") {
const fileName = path.join(process.cwd(), `${filename}.json`);
fs.writeFile(fileName, JSON.stringify(data), "utf-8")
.then(() => console.log("File was saved successfully!"))
.catch((e) => console.log(e));
}
export default save;