File

public final class File: Sequence

A file in GridFS

  • id

    The ObjectID for this file

    Declaration

    Swift

    public let id: ObjectId
  • The amount of bytes in this file

    Declaration

    Swift

    public let length: Int
  • The amount of data per chunk

    Declaration

    Swift

    public let chunkSize: Int32
  • The date on which this file has been uploaded

    Declaration

    Swift

    public let uploadDate: Date
  • md5

    The file’s MD5 hash

    Declaration

    Swift

    public let md5: String
  • The file’s name (if any)

    Declaration

    Swift

    public let filename: String?
  • The file’s content-type (MIME) (if any)

    Declaration

    Swift

    public let contentType: String?
  • The aliases for this file (if any)

    Declaration

    Swift

    public let aliases: [String]?
  • The metadata for this file (if any)

    Declaration

    Swift

    public let metadata: BSON.Primitive?
  • Finds all or specific chunks

    Returns the bytes you selected

    Declaration

    Swift

    public func read(from start: Int = 0, to end: Int? = nil) throws -> Bytes
  • Iterates over all chunks of data for this file

    Declaration

    Swift

    public func makeIterator() -> AnyIterator<Chunk>
  • Creates an iterator of chunks.

    Throws

    Unable to fetch chunks

    Declaration

    Swift

    public func chunked() throws -> Cursor<Chunk>
  • A GridFS Byte Chunk that’s part of a file

    See more

    Declaration

    Swift

    public class Chunk