https://github.com/civilcode/remote-file-streamer
RemoteFileStreamer is an Elixir micro-library for remote file streaming
https://github.com/civilcode/remote-file-streamer
elixir elixir-lang
Last synced: about 1 year ago
JSON representation
RemoteFileStreamer is an Elixir micro-library for remote file streaming
- Host: GitHub
- URL: https://github.com/civilcode/remote-file-streamer
- Owner: civilcode
- License: mit
- Created: 2018-05-04T20:35:20.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-14T17:33:45.000Z (about 7 years ago)
- Last Synced: 2025-04-09T04:11:12.327Z (about 1 year ago)
- Topics: elixir, elixir-lang
- Language: Elixir
- Homepage: http://labs.civilcode.io/elixir/2018/05/03/stream-files.html
- Size: 31.3 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RemoteFileStreamer
RemoteFileStreamer is a micro-library to stream a remote file.
Mostly, it provides a `stream` function taking a url as an input and returns a stream out of it.
If the server hosting the resource allows it, a file a streamed from a url
## Installation
The package is [available in Hex](https://hex.pm/packages/remote_file_streamer), and can be installed
by adding `file_streamer` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:remote_file_streamer, "~> 1.0"}
]
end
```
## Examples
The following example will stream the content from the file located in the url, and consume the stream by outputing every chunks composing the resource:
```
url
|> RemoteFileStream.stream
|> Enum.each(fn(chunk) -> IO.puts chunk end)
```
# Documentation
- [HexDocs](https://hexdocs.pm/remote_file_streamer/0.1.0/api-reference.html)
- A usage of the library is described in [this blogpost](http://labs.civilcode.io/elixir/2018/05/03/stream-files.html).