Google Code offered in: English - Español - 日本語 - 한국어 - Português - Pусский - 中文(简体) - 中文(繁體)
Package blobstore provides a client for App Engine's persistent blob storage service.
func Delete(c appengine.Context, blobKey appengine.BlobKey) os.Error
Delete deletes a blob.
func DeleteMulti(c appengine.Context, blobKey []appengine.BlobKey) os.Error
DeleteMulti deletes multiple blobs.
func ParseUpload(req *http.Request) (blobs map[string][]*BlobInfo, other url.Values, err os.Error)
ParseUpload parses the synthetic POST request that your app gets from App Engine after a user's successful upload of blobs. Given the request, ParseUpload returns a map of the blobs received (keyed by HTML form element name) and other non-blob POST parameters.
func Send(response http.ResponseWriter, blobKey appengine.BlobKey)
Send sets the headers on response to instruct App Engine to send a blob as the response body. This is more efficient than reading and writing it out manually and isn't subject to normal response size limits.
func UploadURL(c appengine.Context, successPath string, opts *UploadURLOptions) (*url.URL, os.Error)
UploadURL creates an upload URL for the form that the user will fill out, passing the application path to load when the POST of the form is completed. These URLs expire and should not be reused. The opts parameter may be nil.
BlobInfo is the blob metadata that is stored in the datastore.
type BlobInfo struct {
BlobKey appengine.BlobKey
ContentType string
CreationTime *time.Time
Filename string // if provided
Size int64
}
func Stat(c appengine.Context, blobKey appengine.BlobKey) (*BlobInfo, os.Error)
Stat returns the BlobInfo for a provided blobKey. If no blob was found for that key, Stat returns datastore.ErrNoSuchEntity.
Reader is a blob reader.
type Reader interface { io.Reader io.ReaderAt io.Seeker }
func NewReader(c appengine.Context, blobKey appengine.BlobKey) Reader
NewReader returns a reader for a blob. It always succeeds; if the blob does not exist then an error will be reported upon first read.
UploadURLOptions are the options to create an upload URL.
type UploadURLOptions struct { MaxUploadBytes int64 // optional MaxUploadBytesPerBlob int64 // optional }
Writer is used for writing blobs. Blobs aren't fully written until Close is called, at which point the key can be retrieved by calling the Key method.
type Writer struct {
// contains filtered or unexported fields
}
func Create(c appengine.Context, mimeType string) (*Writer, os.Error)
Create begins creating a new blob. The provided mimeType if non-empty is stored in the blob's BlobInfo in datastore, else defaults to application/octet-stream. The returned Writer should be written to, then closed, and then its Key method can be called to retrieve the newly-created blob key if there were no errors.
func (w *Writer) Close() (closeErr os.Error)
Close flushes outstanding buffered writes and finalizes the blob. After calling Close the key can be retrieved by calling Key.
func (w *Writer) Key() (appengine.BlobKey, os.Error)
Key returns the created blob key. It must be called after Close. An error is returned if Close wasn't called or returned an error.
func (w *Writer) Write(p []byte) (n int, err os.Error)