Skip to content

Instantly share code, notes, and snippets.

@noisesmith
Created October 27, 2016 21:37
Show Gist options
  • Save noisesmith/d6f8ed1a75c0b57873f100390f0bec54 to your computer and use it in GitHub Desktop.
Save noisesmith/d6f8ed1a75c0b57873f100390f0bec54 to your computer and use it in GitHub Desktop.
get a file over http, at an arbitrary offset, without downloading everything
(import (java.net URL))
(defn skipped-url
[url byte-skip byte-end]
(let [http-connection (.openConnection url)]
(.setRequestProperty http-connection
"Range" (str "bytes=" byte-skip "-" byte-end))
(.getInputStream http-connection)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment