New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

taki

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

taki

Take a snapshot of any website.

  • 0.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
183
decreased by-36.46%
Maintainers
1
Weekly downloads
 
Created
Source

taki

NPM version NPM downloads CircleCI donate

Install

yarn add taki

Usage

const taki = require('taki')

// Prerender this page to static HTML
// Wait for 1s since this page renders remote markdown file
taki({ url: 'https://sao.js.org', wait: 1000 })
.then(html => {
  // serialized html string of target url
  console.log(html)
})

Multiplate URLs

taki({
  url: ['https://sao.js.org', 'https://sao.js.org/#/create']
}).then(result => {
  // Then the result will an array of html string
})

Choose a browser

Can be eithor jsdom (default) or chrome.

When you choose chrome it will prefer chromium if it's also installed.

taki({
  url,
  browser: 'chrome'
})

Manually take snapshot

By default taki will take a snapshot of the URL in a specific timeout (50 by default) when all resource are loaded, if you have control of the website's source code, you can disable that and manually call window.snapshot:

taki({
  url: 'http://my-web.com',
  manually: true
})

And in your website's source code:

fetchSomeData().then(data => {
  this.setState({ data }, () => {
+    window.snapshot && window.snapshot()
  })
})

Wait

Wait for specific timeout or a CSS selector to appera in dom.

taki({
  url,
  // Wait for 3000 ms
  wait: 3000,
  // Or wait for <div class="comments"></div> to appear
  wait: '.comments'
})

Resource filter

Only for browser: 'jsom'

By default we fetch all resources in script tag, but you can control which should be excluded:

const URL = require('url')

const url = 'http://example-website.com'

taki({
  url,
  resourceFilter(resource) {
    // Only fetch resources from the same host
    return resource.url.host === URL.parse(url).host
  }
})

See the resource definition here.

Canvas support

It's supported natively in chrome, but if you want to use it in jsdom, please install canvas or canvas-prebuilt alongside taki.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

taki © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoist.moe · GitHub @egoist · Twitter @rem_rin_rin

Keywords

FAQs

Package last updated on 25 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc