Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eat

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eat

  • 0.1.8
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

=eat

Problems with the standard open-uri library

  • sometimes it returns String and sometimes StringIO (check out OpenURI::Buffer::StringMax, usually 10,240 bytes)
  • sometimes you have to call gets (for example open('http://yahoo.com').gets)
  • it overrides #open everywhere, which may be confusing.

Try #eat, which ALWAYS returns a String:

require 'eat'
eat('http://yahoo.com')                 #=> String
eat('/home/seamus/foo.txt')             #=> String
eat('file:///home/seamus/foo.txt')      #=> String

==Options

eat('http://yahoo.com', :timeout => 10)                   # timeout after 10 seconds
eat('http://yahoo.com', :limit => 1024)                   # only read the first 1024 chars
eat('https://yahoo.com', :openssl_verify_mode => 'none')  # don't bother verifying SSL certificate

==Warning: DOES verify SSL certs

If you want to disable verification of SSL certificates, use

:openssl_verify_mode => 'none'

Thanks @codahale and @peterc for their suggestions.

==Supported schemas

  • local filesystem
  • http
  • https

Copyright 2011 Seamus Abshere

FAQs

Package last updated on 13 Dec 2011

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