sakshshot
v1.0.3
Published
A Node.js package to take screenshots of a given URL
Downloads
86
Maintainers
Readme
Screenshot Package
A Node.js package to take screenshots of a given URL using Puppeteer.
Installation
To install the package, run:
npm install sakshshot
Usage
You can use the package as a library in your Node.js application.
const sakshshot = require('sakshshot');
const fs = require('fs');
const path = require('path');
async function captureScreenshot(url) {
const outputPath = path.join(__dirname, 'screenshot.png');
await takeScreenshot(url, outputPath);
const image = fs.readFileSync(outputPath);
return image;
}
// Example usage
(async () => {
try {
const url = 'https://example.com';
const image = await sakshshot(url);
console.log('Screenshot captured successfully');
// Do something with the image, e.g., save it, send it in a response, etc.
} catch (error) {
console.error('Error capturing screenshot:', error);
}
})();
Testing
To run the example usage:
node main.js
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Contact
For any questions or feedback, please contact susheel2339 @ gmail.com