struct DynFork::Globals::Types::FileData

Overview

Data type for FileField.

Included Modules

Defined in:

dynfork/globals/types.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]
def self.new(bson : BSON) #

Allocate an instance and copies data from a BSON struct.

class User
  include BSON::Serializable
  property name : String
end

data = BSON.new
data["name"] = "John"
User.new(data)

[View source]
def self.new #

[View source]

Class Method Detail

def self.from_bson(bson : BSON) #

NOTE See self.new.


[View source]

Instance Method Detail

def delete=(delete : Bool) #

If the file needs to be deleted: delete=true.
By default: delete=false.


[View source]
def delete? : Bool #

If the file needs to be deleted: delete=true.
By default: delete=false.


[View source]
def extension : String #

File extension.
Examples: .txt|.xml|.doc|.svg


[View source]
def extension=(extension : String) #

File extension.
Examples: .txt|.xml|.doc|.svg


[View source]
def name : String #

Original file name.


[View source]
def name=(name : String) #

Original file name.


[View source]
def path : String #

Path to file.


[View source]
def path=(path : String) #

Path to file.


[View source]
def size : Int64 #

File size in bytes.


[View source]
def size=(size : Int64) #

File size in bytes.


[View source]
def to_bson(bson = BSON.new) #

Converts to a BSON representation.

user = User.new name: "John"
bson = user.to_bson

[View source]
def url : String #

URL to file.


[View source]
def url=(url : String) #

URL to file.


[View source]