UNPKG

@yawetse/pkgcloud

Version:

An infrastructure-as-a-service agnostic cloud library for node.js

36 lines (28 loc) 939 B
/* * file.js: Base container from which all pkgcloud files inherit from * * (C) 2010 Charlie Robbins, Ken Perkins, Ross Kukulinski & the Contributors. * */ var util = require('util'), model = require('../base/model'), storage = require('../storage'); var File = exports.File = function (client, details) { model.Model.call(this, client, details); }; util.inherits(File, model.Model); File.prototype.remove = function (callback) { this.client.removeFile(this.containerName, this.name, callback); }; File.prototype.download = function (options, callback) { this.client.download(options, callback); }; File.prototype.__defineGetter__('fullPath', function () { return this.client._getUrl({ container: this.containerName, path: this.name }); }); File.prototype.__defineGetter__('containerName', function () { return this.container instanceof storage.Container ? this.container.name : this.container; });