Tabnine Logo For Javascript
File.name
Code IndexAdd Tabnine to your IDE (free)

How to use
name
function
in
File

Best JavaScript code snippets using parse.File.name(Showing top 9 results out of 315)

origin: parse-community/parse-server

it('save file', async () => {
  const file = new Parse.File('hello.txt', data, 'text/plain');
  ok(!file.url());
  const result = await file.save();
  strictEqual(result, file);
  ok(file.name());
  ok(file.url());
  notEqual(file.name(), 'hello.txt');
 });
origin: parse-community/parse-server

it('beforeSaveFile should return same file data with new file name', async () => {
  await reconfigureServer({ filesAdapter: mockAdapter });
  const config = Config.get('test');
  config.filesController.options.preserveFileName = true;
  Parse.Cloud.beforeSaveFile(async ({ file }) => {
   expect(file.name()).toBe('popeye.txt');
   const fileData = await file.getData();
   const newFile = new Parse.File('2020-04-01.txt', { base64: fileData });
   return newFile;
  });
  const file = new Parse.File('popeye.txt', [1, 2, 3], 'text/plain');
  const result = await file.save({ useMasterKey: true });
  expect(result.name()).toBe('2020-04-01.txt');
 });
origin: parse-community/parse-server

it('autosave file in object', async done => {
  let file = new Parse.File('hello.txt', data, 'text/plain');
  ok(!file.url());
  const object = new Parse.Object('TestObject');
  await object.save({ file });
  const objectAgain = await new Parse.Query('TestObject').get(object.id);
  file = objectAgain.get('file');
  ok(file instanceof Parse.File);
  ok(file.name());
  ok(file.url());
  notEqual(file.name(), 'hello.txt');
  done();
 });
origin: parse-community/parse-server

file.addMetadata('foo', 'bar');
await file.save();
let fileData = await gfsAdapter.getMetadata(file.name());
expect(fileData.metadata).toEqual(metadata);
fileData = await gfsAdapter.getMetadata(file.name());
expect(fileData.metadata).toEqual(metadata);
 method: 'GET',
 headers,
 url: `http://localhost:8378/1/files/test/metadata/${file.name()}`,
});
fileData = response.data;
origin: parse-community/parse-server

it('autosave file in object in object', async done => {
  let file = new Parse.File('hello.txt', data, 'text/plain');
  ok(!file.url());

  const child = new Parse.Object('Child');
  child.set('file', file);

  const parent = new Parse.Object('Parent');
  parent.set('child', child);

  await parent.save();
  const query = new Parse.Query('Parent');
  query.include('child');
  const parentAgain = await query.get(parent.id);
  const childAgain = parentAgain.get('child');
  file = childAgain.get('file');
  ok(file instanceof Parse.File);
  ok(file.name());
  ok(file.url());
  notEqual(file.name(), 'hello.txt');
  done();
 });
origin: parse-community/parse-server

it('two saves at the same time', done => {
  const file = new Parse.File('hello.txt', data, 'text/plain');

  let firstName;
  let secondName;

  const firstSave = file.save().then(function() {
   firstName = file.name();
  });
  const secondSave = file.save().then(function() {
   secondName = file.name();
  });

  Promise.all([firstSave, secondSave]).then(
   function() {
    equal(firstName, secondName);
    done();
   },
   function(error) {
    ok(false, error);
    done();
   }
  );
 });
origin: parse-community/parse-server

it('save file in object', async done => {
  const file = new Parse.File('hello.txt', data, 'text/plain');
  ok(!file.url());
  const result = await file.save();
  strictEqual(result, file);
  ok(file.name());
  ok(file.url());
  notEqual(file.name(), 'hello.txt');

  const object = new Parse.Object('TestObject');
  await object.save({ file: file });
  const objectAgain = await new Parse.Query('TestObject').get(object.id);
  ok(objectAgain.get('file') instanceof Parse.File);
  done();
 });
origin: parse-community/parse-server

it('saving an already saved file', async () => {
  const file = new Parse.File('hello.txt', data, 'text/plain');
  ok(!file.url());
  const result = await file.save();
  strictEqual(result, file);
  ok(file.name());
  ok(file.url());
  notEqual(file.name(), 'hello.txt');
  const previousName = file.name();

  await file.save();
  equal(file.name(), previousName);
 });
origin: parse-community/parse-server

it('save file in object with escaped characters in filename', async () => {
  const file = new Parse.File('hello . txt', data, 'text/plain');
  ok(!file.url());
  const result = await file.save();
  strictEqual(result, file);
  ok(file.name());
  ok(file.url());
  notEqual(file.name(), 'hello . txt');

  const object = new Parse.Object('TestObject');
  await object.save({ file });
  const objectAgain = await new Parse.Query('TestObject').get(object.id);
  ok(objectAgain.get('file') instanceof Parse.File);
 });
parse(npm)Filename

Most used parse functions

  • Cloud
  • Config
  • User
  • ACL
  • ACL.ACL
  • ACL.setPublicReadAccess,
  • ACL.setPublicWriteAccess,
  • ACL.setReadAccess,
  • ACL.setRoleReadAccess,
  • ACL.setRoleWriteAccess,
  • ACL.setWriteAccess,
  • Analytics,
  • Error,
  • FacebookUtils,
  • File,
  • File.File,
  • File._name,
  • File._url,
  • File.addMetadata

Popular in JavaScript

  • glob
    a little globber
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • mime-types
    The ultimate javascript content-type utility.
  • async
    Higher-order functions and common patterns for asynchronous code
  • colors
    get colors in your node.js console
  • ms
    Tiny millisecond conversion utility
  • path
  • mongodb
    The official MongoDB driver for Node.js
  • moment
    Parse, validate, manipulate, and display dates
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now