Temporal v0.2.2 Temporal.Fetch View Source
Link to this section Summary
Functions
Clean up a possible fetched file
Go and fetch the data if it’s time, using the provided method
Touch a file, useful if you want to “skip” a download
Link to this section Functions
Clean up a possible fetched file
Examples
iex> Temporal.Fetch.clean(%{basedir: "/tmp/", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/tmp/20170504/my.a4word.com/webfiles/x.txt"
iex> Temporal.Fetch.clean(%{basedir: "/etc/bad", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/etc/bad/20170504/my.a4word.com/webfiles/x.txt"
Go and fetch the data if it’s time, using the provided method.
iex> Temporal.Fetch.clean(%{source: "https://raw.githubusercontent.com/aforward/webfiles/master/x.txt"})
...> Temporal.Fetch.go(%{source: "https://raw.githubusercontent.com/aforward/webfiles/master/x.txt"})
{:ok, "/tmp/20170504/raw.githubusercontent.com/aforward/webfiles/master/x.txt"}
iex> Temporal.Fetch.go(%{method: :get, source: "https://raw.githubusercontent.com/aforward/webfiles/master/x.txt"})
{:skip, "/tmp/20170504/raw.githubusercontent.com/aforward/webfiles/master/x.txt"}
iex> Temporal.Fetch.go(%{force: true, method: :get, source: "https://raw.githubusercontent.com/aforward/webfiles/master/x.txt"})
{:ok, "/tmp/20170504/raw.githubusercontent.com/aforward/webfiles/master/x.txt"}
Touch a file, useful if you want to “skip” a download
Examples
iex> Temporal.Fetch.touch(%{basedir: "/tmp/", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/tmp/20170504/my.a4word.com/webfiles/x.txt"
iex> Temporal.Fetch.touch(%{basedir: "/etc/bad", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/etc/bad/20170504/my.a4word.com/webfiles/x.txt"