diff --git a/README.md b/README.md index 5f449cc..8033038 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ RETURNS: an ACL. ## Download a file from a node ``` AUTHORIZATION OPTIONAL -GET /node/?download[_raw] +GET /node/?download[_raw][&seek=#][&length=#] RETURNS: the file content. ``` @@ -179,6 +179,13 @@ RETURNS: the file content. `?download_raw`, as opposed to `?download`, causes the `Content-Disposition` header to be omitted. +`seek` causes the first `#` bytes of the file to be skipped. A `seek` value greater than or equal +to the file size is an error. Defaults to 0. + +`length` determines the number of bytes of the file to return after skipping `seek` bytes. +`length` may be greater than the remaining file length. Defaults to 0, which indicates that the +remainder of the file should be returned. + ## Set a node to be publicly readable ``` AUTHORIZATION REQUIRED diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4207b09..5b3bab4 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +# 0.1.1 + +- Added seek & length parameters to file download requests + # 0.1.0 - Initial release \ No newline at end of file diff --git a/app/blobstore.go b/app/blobstore.go index 959d821..8a5b38e 100644 --- a/app/blobstore.go +++ b/app/blobstore.go @@ -19,7 +19,7 @@ import ( const ( name = "blobstore" - version = "0.1.0" + version = "0.1.1" shockname = "Shock" shockver = "0.9.6" // do not increment deprecation = "The id and version fields are deprecated." diff --git a/service/integration_test.go b/service/integration_test.go index b4c53c2..18034b3 100644 --- a/service/integration_test.go +++ b/service/integration_test.go @@ -502,7 +502,7 @@ func (t *TestSuite) TestStoreAndGetWithFilename() { t.checkFile(t.url+path2+"?download_raw", path2, &t.noRole, 9, "", []byte("foobarbaz")) } -func (t *TestSuite) TestStoreAndGetNodeAsAdminWithFormatAndTrailingSlashAndSeekAndGet() { +func (t *TestSuite) TestStoreAndGetNodeAsAdminWithFormatAndTrailingSlashAndSeekAndLength() { body := t.req("POST", t.url+"/node/?format=JSON", strings.NewReader("foobarbaz"), "oauth "+t.noRole.token, 378, 200) t.checkLogs(logEvent{logrus.InfoLevel, "POST", "/node/", 200, ptr("noroles"),